internal static void PatchFilesUpdateRoutine(UpdateWindow ui, Dictionary <string, object> args) { var updateData = (UpdateData)args["updateData"]; if (updateData != null) { //----------------------------- // Update patch files //----------------------------- var currentPatchHash = Riot.GetCurrentPatchHash().ToLower(); PatchData patch; updateData.Patches.TryGetValue(currentPatchHash, out patch); if (patch != null && !DeveloperHelper.IsDeveloper) { var currentProgress = 0; ui.Status = MultiLanguage.Text.UpdateStatusPatchFiles; ui.Details = ""; foreach (var keyPair in patch.Files) { var path = keyPair.Key; var filename = Path.GetFileName(path); currentProgress += 1; ui.CurrentProgress = 0; ui.OveralCurrentProgress = currentProgress; ui.OveralMaxProgress = patch.Files.Count + 1; ui.Details = string.Format(MultiLanguage.Text.UpdateDetailsCheckingFile, filename); if (!Md5Hash.Compare(Md5Hash.ComputeFromFile(path), keyPair.Value.MD5)) { if (!string.IsNullOrEmpty(keyPair.Value.Download)) { ui.Details = string.Format(MultiLanguage.Text.UpdateDetailsDownloadingFile, filename); if (!DownloadFile(keyPair.Value.Download, path)) { ExitDownloadError(filename); } } else if (File.Exists(path)) { File.Delete(path); } } } ui.OveralCurrentProgress = ui.OveralMaxProgress; } // Set patch update result LoaderUpdate.LeagueHash = currentPatchHash; LoaderUpdate.LeagueVersion = string.IsNullOrEmpty(currentPatchHash) ? string.Empty : Riot.GetCurrentPatchVersionInfo().FileVersion; LoaderUpdate.UpToDate = DeveloperHelper.IsDeveloper || patch != null; if (patch != null && LoaderUpdate.UpToDate) { LoaderUpdate.CoreHash = Md5Hash.ComputeFromFile(Settings.Instance.Directories.CoreDllPath); if (args.ContainsKey("coreData")) { var jsonNews = (CoreNewsList)args["coreData"]; var coreItem = jsonNews.News.FirstOrDefault(n => n.Hash != null && n.Hash.Any(h => Md5Hash.Compare(h, LoaderUpdate.CoreHash))); LoaderUpdate.CoreBuild = coreItem != null ? coreItem.Build : "Unknown"; } else { LoaderUpdate.CoreBuild = "Unknown"; } } Log.Instance.DoLog(string.Format("League hash detected: \"{0}\"", currentPatchHash)); Log.Instance.DoLog(string.Format("EloBuddy updated for current patch: {0}", patch != null)); Log.Instance.DoLog(string.Format("Update status: \"{0}\"", LoaderUpdate.StatusString)); } }