/// <summary> /// Loads the categories from an online source. /// </summary> /// <param name="p_uriDefaultCategories">The online path where the category file is stored.</param> public void ResetCategories(Uri p_uriDefaultCategories) { m_tslCategories.Clear(); m_tslCategories.Add(new ModCategory()); if (p_uriDefaultCategories != null) { LoadCategories(XDocument.Load(p_uriDefaultCategories.AbsoluteUri)); } SaveCategories(); }
/// <summary> /// Commits the changes to the <see cref="PluginOrderLog"/>. /// </summary> public void Commit() { PluginComparer pcpComparer = PluginComparer.Filename; Dictionary <Plugin, Plugin> dicPredecessors = new Dictionary <Plugin, Plugin>(); ThreadSafeObservableList <Plugin> oclUnorderedList = EnlistedPluginOrderLog.m_oclOrderedPlugins; // Removed faulty lock, it should no longer be necessary anyway //lock (EnlistedPluginOrderLog.m_oclOrderedPlugins) //{ EnlistedPluginOrderLog.m_oclOrderedPlugins.CollectionChanged -= MasterOrderedPlugins_CollectionChanged; IList <Plugin> lstOrderedList = m_oclOrderedPlugins; //sort the items whose order has been specified for (Int32 i = 0; i < lstOrderedList.Count; i++) { Int32 intOldIndex = 0; for (intOldIndex = 0; intOldIndex < oclUnorderedList.Count; intOldIndex++) { if (pcpComparer.Equals(oclUnorderedList[intOldIndex], lstOrderedList[i])) { break; } } if (intOldIndex == oclUnorderedList.Count) { oclUnorderedList.Insert(i, lstOrderedList[i]); continue; } if (intOldIndex != i) { oclUnorderedList.Move(intOldIndex, i); } } //as the transacted order list has been kept in sync with the master list // the transacted list is canonical (it contains all of the plugins, // and no plugins that shouldn't be present), so // if a plugin is not in the transacted list it means the plugin was removed, // and should be removed form the master list for (Int32 i = oclUnorderedList.Count - 1; i >= lstOrderedList.Count; i--) { oclUnorderedList.RemoveAt(i); } EnlistedPluginOrderLog.OrderValidator.CorrectOrder(oclUnorderedList); //} EnlistedPluginOrderLog.SavePluginLog(); m_booEnlisted = false; m_oclOrderedPlugins.Clear(); }
public void SetConfig(ThreadSafeObservableList <IModProfile> p_iplProfiles) { m_tslProfiles.Clear(); m_tslProfiles = new ThreadSafeObservableList <IModProfile>(p_iplProfiles); }