private void OnStartUnpackingPatch(PatchHistory patch) { Timer1TickAction += () => { InsertOnLogListBox($"{Language.Patching2Unpacking} {patch.BuildPatchPath}"); UpdateMenuLabels(MenuState.Unpacking, new Dictionary<string, string>() { { "patchname", $"{patch.PatchVersionName} - {patch.BuildPatchPath}" } }); }; }
private void OpenUpdaterDialog() { PatchHistory patchHistory = PatchHistory.CreatePatchHistoryInstance(latestPatchHistoryPath); if (patchHistory.ID == Parameter.GameClientSettingsInformation.ClientVersionHistory.ID) { Close(DialogResult.No); } else { Hide(); GameUpdater gU = new GameUpdater(patchHistory); Close(gU.ShowDialog()); } }
private void OnFinalizeDownloadingFile(Queue<Action> actionQueue, PatchHistory patchHistory) { Timer1TickAction += new Action(() => { InsertOnLogListBox($"{Language.Patching3Downloading} {patchHistory.BuildPatchPath}"); currentDownloadedFile++; totalProgressBar.Value = (int)Math.Ceiling(100 * (currentDownloadedFile / (float)patchesToBeDownloaded.Count)); if (actionQueue.Count > 0) { actionQueue.Dequeue().Invoke(); } else { StartUnpackingFiles(); } }); }
public GameUpdater(PatchHistory serverPatchHistory) { InitializeComponent(); Timer1TickAction = new AsynchronousAction(); Timer2TickAction = new AsynchronousAction(); shouldShowLog = true; interfaceLabels = new Label[] { downloadLabel1, downloadLabel2, downloadLabel3 }; currentPatchEntry = Parameter.GameClientSettingsInformation.ClientVersionHistory; patchesToBeDownloaded = serverPatchHistory.PatchHistoryList.Union(new List<PatchHistory> { serverPatchHistory }) .Where((x) => x.CreationDate > currentPatchEntry.CreationDate) .OrderBy((x) => x.CreationDate).ToList(); UpdateMenuLabels(MenuState.ReadyToDownload); InsertOnLogListBox(Language.Patching1Ready); }
private void OnUnpackPatch(PatchHistory patch, bool isMD5Valid, Exception exception) { Timer1TickAction += () => { int current = patchesToBeDownloaded.IndexOf(patch); int total = patchesToBeDownloaded.Count; totalProgressBar.Value = currentProgressBar.Value = 100 * ((current + 1) / total); if (exception != null) { InsertOnLogListBox($"{Language.Patching1ExceptionUnpack} {patch.BuildPatchPath}"); InsertOnLogListBox($"{Language.Patching2ExceptionUnpack}"); HaltPatchingProcess(exception); } else if (!isMD5Valid) { InsertOnLogListBox($"{Language.Patching1ExceptionUnpack} {patch.BuildPatchPath}"); InsertOnLogListBox($"{Language.Patching3ExceptionUnpack}"); HaltPatchingProcess(); } else { InsertOnLogListBox($"{Language.Patching3Unpacking} {patch.BuildPatchPath}"); } if (patchesToBeDownloaded.Last() == patch) { timer2.Enabled = true; InsertOnLogListBox($"{Language.Patching2Done}"); DateTime date = DateTime.Now; CloseClientAndApplyPatchTickAction(date); } }; }
private static string BuildPatchPath(string outputPath, PatchHistory patchHistory) => @$ "{outputPath}\{patchHistory.BuildPatchPath}";
private void OnFailToDownloadPatch(Exception exception, PatchHistory patchHistory) { InsertOnLogListBox($"{Language.Patching4ExceptionUnpack} {patchHistory.BuildPatchPath}"); InsertOnLogListBox($"{Language.Patching5ExceptionUnpack}"); HaltPatchingProcess(exception); }