Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/c#/GeneralUpdate.Core/FileSystem/StorageManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -231,6 +231,20 @@ private static void CopyDirectory(string sourceDir, string targetDir)
}
}

public static async System.Threading.Tasks.Task BackupAsync(string sourcePath, string backupPath, System.Collections.Generic.IReadOnlyList<string> directoryNames)
{
await System.Threading.Tasks.Task.Run(() => Backup(sourcePath, backupPath, directoryNames)).ConfigureAwait(false);
}

public static async System.Threading.Tasks.Task RestoreAsync(string backupPath, string sourcePath)
{
await System.Threading.Tasks.Task.Run(() => Restore(backupPath, sourcePath)).ConfigureAwait(false);
}

public static async System.Threading.Tasks.Task CleanBackupAsync(string installPath, int keepVersions = 3)
{
await System.Threading.Tasks.Task.Run(() => CleanBackup(installPath, keepVersions)).ConfigureAwait(false);
}
#endregion

#region Private Methods
Expand Down Expand Up @@ -326,4 +340,4 @@ public sealed class BackupConfig

/// <summary>Backup metadata.</summary>
public record BackupInfo(string Version, string Path, DateTime CreatedAt, long SizeBytes);
}
}
6 changes: 5 additions & 1 deletion src/c#/GeneralUpdate.Core/Strategy/ClientUpdateStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -31,6 +31,10 @@ public class ClientUpdateStrategy : IStrategy
private IStrategy? _osStrategy;
private Func<UpdateInfoEventArgs, bool>? _updatePrecheck;
private readonly List<Func<bool>> _customOptions = new();
private readonly Download.Abstractions.IDownloadOrchestrator? _orchestrator;
private readonly DiffMode _diffMode = DiffMode.Serial;

public ClientUpdateStrategy(Download.Abstractions.IDownloadOrchestrator? orchestrator = null) { _orchestrator = orchestrator; }

public void Create(GlobalConfigInfo parameter)
{
Expand Down
6 changes: 5 additions & 1 deletion src/c#/GeneralUpdate.Core/Strategy/UpgradeUpdateStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -26,6 +26,10 @@ public class UpgradeUpdateStrategy : IStrategy
{
private GlobalConfigInfo? _configInfo;
private IStrategy? _osStrategy;
private readonly Download.Abstractions.IDownloadOrchestrator? _orchestrator;
private readonly DiffMode _diffMode = DiffMode.Serial;

public UpgradeUpdateStrategy(Download.Abstractions.IDownloadOrchestrator? orchestrator = null) { _orchestrator = orchestrator; }

public void Create(GlobalConfigInfo parameter)
{
Expand Down
Loading