/// <summary>
 /// Deregisters the given mod.
 /// </summary>
 /// <param name="p_modMod">The mod to deregister.</param>
 public void DeregisterMod(IMod p_modMod)
 {
     m_dicModKeys.Remove(p_modMod);
     for (Int32 i = m_oclRegisteredMods.Count - 1; i >= 0; i--)
     {
         if (ModComparer.Filename.Equals(m_oclRegisteredMods[i], p_modMod))
         {
             m_oclRegisteredMods.RemoveAt(i);
             return;
         }
     }
 }
예제 #2
0
            /// <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();
            }
예제 #3
0
 /// <summary>
 /// Handles the <see cref="IBackgroundTask.TaskEnded"/> event of a task set.
 /// </summary>
 /// <remarks>
 /// This displays the confirmation message.
 /// </remarks>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="TaskSetCompletedEventArgs"/> describing the event arguments.</param>
 private void RunningTask_TaskEnded(object sender, TaskEndedEventArgs e)
 {
     if (RunningTask != null)
     {
         lock (m_objLock)
         {
             if (RunningTask != null)
             {
                 RunningTask.TaskEnded -= RunningTask_TaskEnded;
                 int intPosition = TaskList.IndexOf((WriteLoadOrderTask)RunningTask);
                 RunningTask = null;
                 TaskList.RemoveAt(intPosition);
             }
         }
     }
 }