コード例 #1
0
ファイル: RXPatcher.cs プロジェクト: zloveless/Rx_Launcher
        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);
        }
コード例 #2
0
ファイル: RXPatcher.cs プロジェクト: zloveless/Rx_Launcher
        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?
            }
        }