/// <summary> /// The method that is called to start the backgound task. /// </summary> /// <param name="p_objArgs">Arguments to for the task execution.</param> /// <returns>Always <c>null</c>.</returns> protected override object DoWork(object[] p_objArgs) { OverallMessage = "Deactivating all the active mods..."; OverallProgress = 0; OverallProgressStepSize = 1; OverallProgressMaximum = m_rolModList.Count; ShowItemProgress = false; ConfirmActionMethod camConfirm = (ConfirmActionMethod)p_objArgs[0]; foreach (IMod modMod in m_rolModList) { modMod.InstallDate = null; if (!m_iilInstallLog.ActiveMods.Contains(modMod)) { return(null); } ModUninstaller munUninstaller = m_mifModInstallerFactory.CreateUninstaller(modMod, m_rolModList); munUninstaller.Install(); while (!munUninstaller.IsCompleted) { } if (OverallProgress < OverallProgressMaximum) { StepOverallProgress(); } } return(null); }
/// <summary> /// deactivates the given mod. /// </summary> /// <param name="p_modMod">The mod to deactivate.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet DeactivateMod(IMod p_modMod, ReadOnlyObservableList <IMod> p_rolActiveMods) { if (!InstallationLog.ActiveMods.Contains(p_modMod)) { return(null); } ModUninstaller munUninstaller = InstallerFactory.CreateUninstaller(p_modMod, p_rolActiveMods); munUninstaller.Install(); return(munUninstaller); }
/// <summary> /// Removes the given uninstalling task (the task is already in queue or running). /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveUselessTaskUn(ModUninstaller p_tskTask) { ActivateModsMonitor.RemoveUselessTaskUn(p_tskTask); }
/// <summary> /// Removes the uninstalling given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveSelectedTaskUn(ModUninstaller p_tskTask) { if (ActivateModsMonitor.CanRemoveSelectedUn(p_tskTask)) { if (p_tskTask.IsCompleted) ActivateModsMonitor.RemoveTaskUn(p_tskTask); else if (p_tskTask.IsQueued) ActivateModsMonitor.RemoveQueuedTaskUn(p_tskTask); } }
/// <summary> /// Removes the uninstalling given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveQueuedTaskUn(ModUninstaller p_tskTask) { if (ActivateModsMonitor.CanRemoveQueuedUn(p_tskTask)) ActivateModsMonitor.RemoveQueuedTaskUn(p_tskTask); }
/// <summary> /// Determines if the given uninstalling <see cref="BasicInstallTask"/> selected can be removed from /// the monitor. /// </summary> /// <param name="p_tskTask">The task for which it is to be determined /// if it can be removed from the monitor.</param> /// <returns><c>true</c> if the p_tskTask can be removed; /// <c>false</c> otherwise.</returns> public bool CanRemoveSelectedUn(ModUninstaller p_tskTask) { if (p_tskTask.IsQueued || p_tskTask.IsCompleted) return true; else return false; }
/// <summary> /// Determines if the given uninstalling <see cref="BasicInstallTask"/> queued can be removed from /// the monitor. /// </summary> /// <param name="p_tskTask">The task for which it is to be determined /// if it can be removed from the monitor.</param> /// <returns><c>true</c> if the p_tskTask can be removed; /// <c>false</c> otherwise.</returns> public bool CanRemoveQueuedUn(ModUninstaller p_tskTask) { return p_tskTask.IsQueued; }
/// <summary> /// Determines if the given <see cref="BasicInstallTask"/> can be removed from /// the monitor. /// </summary> /// <param name="p_tskTask">The task for which it is to be determined /// if it can be removed from the monitor.</param> /// <returns><c>true</c> if the p_tskTask can be removed; /// <c>false</c> otherwise.</returns> public bool CanRemoveUn(ModUninstaller p_tskTask) { return p_tskTask.IsCompleted; }
/// <summary> /// Removes a useless uninstalling task (the task is already in queue or running). /// </summary> public void RemoveUselessTaskUn(ModUninstaller p_tskTask) { m_oclTasks.Remove(p_tskTask); }
/// <summary> /// Removes an uninstalling task from the monitor. /// </summary> /// <remarks> /// Tasks can only be removed if they are not running. /// </remarks> /// <param name="p_tskTask">The task to remove.</param> public void RemoveQueuedTaskUn(ModUninstaller p_tskTask) { m_oclTasks.Remove(p_tskTask); }
private bool DeactivateMods(object[] args) { OverallMessage = "Profile Switch Setup: Uninstalling selected active mods..."; OverallProgress = 0; OverallProgressStepSize = 1; OverallProgressMaximum = _modsToDeactivate.Count; ShowItemProgress = true; ItemProgressStepSize = 1; ItemProgressMaximum = 4; ConfirmActionMethod camConfirm = (ConfirmActionMethod)args[0]; _profileManager.SetCurrentProfile(null); foreach (IMod modMod in _modsToDeactivate) { OverallMessage = "Uninstalling: " + modMod.ModName; ItemProgress = 0; if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Disabling: " + modMod.ModName; StepItemProgress(); } if ((VirtualModActivator != null) && (VirtualModActivator.ModCount > 0)) { if (_filesOnly) { VirtualModActivator.DisableModFiles(modMod); } else { VirtualModActivator.DisableMod(modMod); } } if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Setting up uninstall: " + modMod.ModName; StepItemProgress(); } modMod.InstallDate = null; if (!_installLog.ActiveMods.Contains(modMod)) { continue; } ModUninstaller munUninstaller = _modInstallerFactory.CreateUninstaller(modMod, _modsToDeactivate); munUninstaller.Install(); if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Uninstalling: " + modMod.ModName; StepItemProgress(); } while (!munUninstaller.IsCompleted) { } if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Removing XML logs: " + modMod.ModName; StepItemProgress(); } DeleteXMLInstalledFile(modMod); if (OverallProgress < OverallProgressMaximum) { StepOverallProgress(); } } return(true); }
/// <summary> /// The method that is called to start the backgound task. /// </summary> /// <param name="args">Arguments to for the task execution.</param> /// <returns>Always <c>null</c>.</returns> protected override object DoWork(object[] args) { OverallMessage = "Uninstalling all the active mods..."; OverallProgress = 0; OverallProgressStepSize = 1; OverallProgressMaximum = m_rolModList.Count; ShowItemProgress = true; ItemProgressStepSize = 1; ItemProgressMaximum = 4; ConfirmActionMethod camConfirm = (ConfirmActionMethod)args[0]; foreach (IMod modMod in m_rolModList) { OverallMessage = "Uninstalling: " + modMod.ModName; ItemProgress = 0; if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Disabling: " + modMod.ModName; StepItemProgress(); } if ((VirtualModActivator != null) && (VirtualModActivator.ModCount > 0)) { if (m_booFilesOnly) { VirtualModActivator.DisableModFiles(modMod); } else { VirtualModActivator.DisableMod(modMod); } } if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Setting up uninstall: " + modMod.ModName; StepItemProgress(); } modMod.InstallDate = null; if (!m_iilInstallLog.ActiveMods.Contains(modMod)) { continue; } ModUninstaller munUninstaller = m_mifModInstallerFactory.CreateUninstaller(modMod, m_rolModList); munUninstaller.Install(); if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Uninstalling: " + modMod.ModName; StepItemProgress(); } while (!munUninstaller.IsCompleted) { } if (ItemProgress < ItemProgressMaximum) { ItemMessage = "Removing XML logs: " + modMod.ModName; StepItemProgress(); } DeleteXMLInstalledFile(modMod); if (OverallProgress < OverallProgressMaximum) { StepOverallProgress(); } if (m_booCancel) { return(false); } } return(null); }