コード例 #1
0
        public override async Task <bool> ApplyUpdates()
        {
            PatcherContext.SetPatcherState(true);
            PatcherContext.ShowSession();

            var downloader = new PatchDownloader(PatcherContext, _patchSequence, _officialPatchInfo, ClientProfile);
            await Task.Run(() => downloader.Prepare());

            await Task.Run(() => downloader.Patch());

            WriteVersion(_remoteVersion);

            PatcherContext.SetPatcherState(false);
            PatcherContext.HideSession();
            return(true);
        }
コード例 #2
0
ファイル: NxlPatcher.cs プロジェクト: timunie/HyddwnLauncher
        public override async Task <bool> ApplyUpdates()
        {
            if (ValidateAction())
            {
                return(false);
            }

            PatcherContext.SetPatcherState(true);
            PatcherContext.ShowSession();
            PatcherContext.UpdateMainProgress(Properties.Resources.ApplyingUpdates, "", 0, true, true);

            var patchDownloader = new PatchDownloader(Patches, ClientProfile, PatcherContext);

            bool result = false;

            try
            {
                await Task.Run(() => patchDownloader.Prepare());

                result = await Task.Run(() => patchDownloader.Patch());

                await Task.Run(() => patchDownloader.Cleanup());
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Failed to patch!");
            }
            finally
            {
                PatcherContext.UpdateMainProgress(result ? Properties.Resources.PatchComplete : Properties.Resources.PatchFailed);

                PatcherContext.SetPatcherState(false);
                PatcherContext.HideSession();
            }

            return(result);
        }