public void AddNewVersionNumberForMod(IMod p_modMod, IModInfo p_mifNewestInfo) { lock (m_oclNewInfo) { Int32 intExistingIndex = m_oclNewInfo.IndexOf(x => (x.Mod == p_modMod)); if (intExistingIndex < 0) m_oclNewInfo.Add(new UpdateInfo(p_modMod, p_mifNewestInfo)); else m_oclNewInfo[intExistingIndex] = new UpdateInfo(p_modMod, p_mifNewestInfo); } } }
/// <summary> /// Checks for the updated information for the given mods. /// </summary> /// <param name="p_lstModList">The mods for which to check for updates.</param> private void CheckForModListUpdate(List <string> p_lstModList) { OverallMessage = "Updating mods info: getting online updates..."; List <IModInfo> mifInfo = new List <IModInfo>(); try { //get mod info for (int i = 0; i <= m_intRetries; i++) { mifInfo = ModRepository.GetModListInfo(p_lstModList); if (mifInfo != null) { break; } Thread.Sleep(1000); } if (mifInfo != null) { ItemProgress = 0; ItemProgressMaximum = mifInfo.Count; OverallProgressMaximum = OverallProgress + mifInfo.Count; foreach (ModInfo modUpdate in mifInfo) { if (m_booCancel) { break; } if (OverallProgress < OverallProgressMaximum) { StepOverallProgress(); } ItemMessage = modUpdate.ModName; foreach (IMod modMod in m_lstModList.Where(x => (String.IsNullOrEmpty(modUpdate.Id) ? "0" : modUpdate.Id) == x.Id)) { if (ItemProgress < ItemProgressMaximum) { StepItemProgress(); } modUpdate.CustomCategoryId = modMod.CustomCategoryId; modUpdate.UpdateWarningEnabled = modMod.UpdateWarningEnabled; AutoUpdater.AddNewVersionNumberForMod(modMod, modUpdate); modMod.UpdateInfo(modUpdate, false); ItemProgress = 0; } } } } catch (RepositoryUnavailableException e) { Trace.WriteLine(String.Format("ModUpdateCheck FAILED: {0}", e.Message)); } }