예제 #1
0
 /// <summary>
 /// Handles the <see cref="INotifyCollectionChanged.CollectionChanged"/> event of the view model's
 /// installed mod list.
 /// </summary>
 /// <remarks>
 /// This updates the list of mods to refelct changes to the installed mod list.
 /// </remarks>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="NotifyCollectionChangedEventArgs"/> describing the event arguments.</param>
 private void TaskList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
     case NotifyCollectionChangedAction.Add:
     case NotifyCollectionChangedAction.Remove:
         lock (m_objLock)
         {
             if ((RunningTask == null) || ((RunningTask.Status != BackgroundTasks.TaskStatus.Queued) && (RunningTask.Status != BackgroundTasks.TaskStatus.Running) && (RunningTask.Status != BackgroundTasks.TaskStatus.Retrying)))
             {
                 if ((TaskList != null) && (TaskList.Count > 0))
                 {
                     lock (TaskList)
                     {
                         WriteLoadOrderTask NextTask = TaskList.FirstOrDefault();
                         RunningTask            = NextTask;
                         RunningTask.TaskEnded += new EventHandler <TaskEndedEventArgs>(RunningTask_TaskEnded);
                         NextTask.Update();
                     }
                 }
             }
         }
         break;
     }
 }
예제 #2
0
        /// <summary>
        /// Sets the load order of the plugins.
        /// </summary>
        /// <remarks>
        /// <param name="p_strPlugins">The list of plugins in the desired order.</param>
        public void SetLoadOrder(string[] p_strPlugins)
        {
            string[] strOrderedPluginNames;

            if ((p_strPlugins == null) || (p_strPlugins.Length == 0))
            {
                return;
            }
            else
            {
                LastValidLoadOrder    = p_strPlugins.ToList();
                strOrderedPluginNames = p_strPlugins;
            }

            if (TimestampOrder)
            {
                try
                {
                    WriteLoadOrderTask wltTask = new WriteLoadOrderTask(String.Empty, strOrderedPluginNames, TimestampOrder, false, m_dtiMasterDate);
                    TaskList.Add(wltTask);
                }
                catch { }
            }
            else
            {
                strOrderedPluginNames = StripPluginDirectory(strOrderedPluginNames);
                SetSortedListLoadOrder(strOrderedPluginNames);
            }

            if (!TimestampOrder && ((m_lstActivePlugins != null) && (m_lstActivePlugins.Count > 0)))
            {
                string[] strOrderedActivePluginNames = strOrderedPluginNames.Intersect(StripPluginDirectory(m_lstActivePlugins.ToArray()), StringComparer.InvariantCultureIgnoreCase).ToArray();
                if ((strOrderedActivePluginNames != null) && (strOrderedActivePluginNames.Length > 0))
                {
                    SetActivePluginsTask(strOrderedActivePluginNames);
                }
            }
        }
		/// <summary>
		/// Sets the load order of the plugins.
		/// </summary>
		/// <remarks>
		/// <param name="p_strPlugins">The list of plugins in the desired order.</param>
		public void SetLoadOrder(string[] p_strPlugins)
		{
			string[] strOrderedPluginNames;

			if ((p_strPlugins == null) || (p_strPlugins.Length == 0))
				return;
			else
			{
				LastValidLoadOrder = p_strPlugins.ToList();
				strOrderedPluginNames = p_strPlugins;
			}

			if (TimestampOrder)
			{
				try
				{
					WriteLoadOrderTask wltTask = new WriteLoadOrderTask(String.Empty, strOrderedPluginNames, TimestampOrder, m_dtiMasterDate);
					TaskList.Add(wltTask);
				}
				catch { }
			}
			else
			{
				strOrderedPluginNames = StripPluginDirectory(strOrderedPluginNames);
				SetSortedListLoadOrder(strOrderedPluginNames);
			}

			if (!TimestampOrder && ((m_lstActivePlugins != null) && (m_lstActivePlugins.Count > 0)))
			{
				string[] strOrderedActivePluginNames = strOrderedPluginNames.Intersect(StripPluginDirectory(m_lstActivePlugins.ToArray()), StringComparer.InvariantCultureIgnoreCase).ToArray();
				if ((strOrderedActivePluginNames != null) && (strOrderedActivePluginNames.Length > 0))
					SetActivePluginsTask(strOrderedActivePluginNames);
			}
		}
		/// <summary>
		/// Handles write operations to the load order file.
		/// </summary>
		private void WriteLoadOrder(string p_strFilePath, string[] p_strPlugins)
		{
			WriteLoadOrderTask wltTask = new WriteLoadOrderTask(p_strFilePath, p_strPlugins, false, m_dtiMasterDate);
			TaskList.Add(wltTask);
		}
예제 #5
0
        /// <summary>
        /// Handles write operations to the load order file.
        /// </summary>
        private void WriteLoadOrder(string p_strFilePath, string[] p_strPlugins, bool p_booReadOnly)
        {
            WriteLoadOrderTask wltTask = new WriteLoadOrderTask(p_strFilePath, p_strPlugins, false, p_booReadOnly, m_dtiMasterDate);

            TaskList.Add(wltTask);
        }