Пример #1
0
        private async Task Patch()
        {
            try
            {
                // reporter is used to pass progress to the view (by just updating the progressBar1.ProgressPercentage)
                var reporter = new ProgressReporter(p => this.ReportProgress(p));
                var patcher  = new Patcher();

                // build config with service call of patch infos
                var config = new PatcherConfig {
                    ModFolder = Path.Combine(UserSettings.Default.Civ5ModFolder)
                };
                patcher.Init(config, reporter);


                ChangeStatus("Downloading patch...");
                // Download patch
                await patcher.DownloadPatch();

                // Backup existing patch
                ChangeStatus("Backuping existing patch...");
                await patcher.BackupMod();


                // Apply patch
                ChangeStatus("Applying patch...");
                await patcher.ApplyPatch();

                ChangeStatus("Done...");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "error");
            }
        }
Пример #2
0
 public void Init(PatcherConfig config, ProgressReporter reporter)
 {
     _reporter      = reporter;
     _config        = config;
     _patchFileName = $"NqMod.DLC.{_config.Version}.zip";
 }