/// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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);
        }