public async Task ApplyPatchFromFilesystem(string patchPath, string targetPath, string applicationDirPath, IProgress <DirectoryPatcherProgressReport> progress, CancellationToken cancellationToken, string instructionsHash) { var backupPath = CreateBackupPath(applicationDirPath); var tempPath = CreateTempPath(applicationDirPath); var patchSource = new FileSystemPatchSource(patchPath); var patcher = new DirectoryPatcher(new XdeltaPatcher(XdeltaPatchSystemFactory.Preferred), targetPath, backupPath, tempPath, patchSource); await patcher.ApplyPatchAsync(progress, cancellationToken, instructionsHash); }
public async Task ApplyPatchFromWebDownloadTask(UpdateServerEntry baseUrl, string targetPath, string applicationDirPath, IProgress <DirectoryPatcherProgressReport> progress, CancellationToken cancellationToken, string instructionsHash) { UpdateServer = baseUrl; var backupPath = CreateBackupPath(applicationDirPath); var downloadPath = CreateDownloadPath(applicationDirPath); var tempPath = CreateTempPath(applicationDirPath); using (var patchSource = new WebPatchSource(this, downloadPath)) { var patcher = new DirectoryPatcher(new XdeltaPatcher(XdeltaPatchSystemFactory.Preferred), targetPath, backupPath, tempPath, patchSource); await patcher.ApplyPatchAsync(progress, cancellationToken, instructionsHash); DirectoryEx.DeleteContents(downloadPath); DirectoryEx.DeleteContents(tempPath); // delete backup? } }