C# Class Nexus.Client.ModManagement.ModManager

The class the encapsulates managing mods.
The list of managed mods needs to be centralized to ensure integrity; having multiple mod managers, each with a potentially different list of managed mods, would be disastrous. As such, this object is a singleton to help enforce that policy. Note, however, that the singleton nature of the manager is not meant to provide global access to the object. As such, there is no static accessor to retrieve the singleton instance. Instead, the Initialize method returns the only instance that should be used.
Show file Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Properties

Property Type Description
IsBackupActive bool
LoginTask LoginFormTask
lstMBInfo List

Public Methods

Method Description
ActivateMod ( IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList p_rolActiveMods ) : IBackgroundTaskSet

Activates the given mod.

AddMod ( string p_strPath, ConfirmOverwriteCallback p_cocConfirmOverwrite ) : IBackgroundTask

Installs the specified mod.

AsyncAddMod ( Uri p_uriPath, ConfirmOverwriteCallback p_cocConfirmOverwrite ) : IBackgroundTask
AsyncAddModTask ( IBackgroundTask p_tskAddModTask ) : void
AsyncEndorseMod ( IMod p_modMod ) : void

Async toggle of the endorsement for the given mod.

AsyncTagMod ( ModManagement p_ModManagerVM, ModManagement p_ModTaggerVM, EventHandler p_TaggingMod ) : void
AsyncUpdateMods ( List p_lstModList, ConfirmActionMethod p_camConfirm, bool p_booOverrideCategorySetup ) : void

Runs the managed updaters.

AsyncUpdateModsTask ( ModUpdateCheckTask p_mutModUpdateCheck, ConfirmActionMethod p_camConfirm ) : Task
DeactivateMod ( IMod p_modMod, ReadOnlyObservableList p_rolActiveMods ) : IBackgroundTaskSet

deactivates the given mod.

DeactivateMultipleMods ( ReadOnlyObservableList p_rolModList, ConfirmActionMethod p_camConfirm ) : IBackgroundTask

Runs the managed updaters.

DeleteMod ( IMod p_modMod, ReadOnlyObservableList p_rolActiveMods ) : IBackgroundTaskSet

Deletes the given mod.

The mod is deactivated, unregistered, and then deleted.

ForceUpgrade ( IMod p_modOldMod, IMod p_modNewMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate ) : IBackgroundTaskSet

Forces an upgrade from one mod to another.

No checks as to whether the two mods are actually related are performed. The new mod is reactivated as if it were the old mod, and the old mod is replaced by the new mod.

GetModTagger ( ) : AutoTagger

Gets the tagger to use to tag mods with metadata.

Initialize ( IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ActivateModsMonitor p_ammMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mrgModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager ) : ModManager

Initializes the singleton intances of the mod manager.

LoadQueuedMods ( ) : void

Loads the list of mods that are queued to be added to the mod manager.

Login ( ) : bool

Logins the user into the current mod repository.

Logout ( ) : void
ReactivateMod ( IMod p_modMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate ) : IBackgroundTaskSet

Reactivates the given mod.

A reactivation is an upgrade of a mod to itself. It re-runs the activation, without changing the installed precedence of its files and installed values.

Release ( ) : void

This disposes of the singleton object, allowing it to be re-initialized.

SetupReadMeManager ( List p_lstModList, ConfirmActionMethod p_camConfirm ) : IBackgroundTask

Runs the managed updaters.

SwitchModCategory ( IMod p_modMod, Int32 p_intCategoryId ) : void

Switches the mod category.

ToggleModEndorsement ( IMod p_modMod ) : void

Toggles the endorsement for the given mod.

ToggleUpdateWarningTask ( HashSet p_hashMods, bool p_booEnable, ConfirmActionMethod p_camConfirm ) : IBackgroundTask

Runs the managed updaters.

UpdateMods ( List p_lstModList, ConfirmActionMethod p_camConfirm, bool p_booOverrideCategorySetup ) : IBackgroundTask

Runs the managed updaters.

Private Methods

Method Description
Deactivator_TaskSetCompleted ( object sender, TaskSetCompletedEventArgs e ) : void

Handles the IBackgroundTaskSet.TaskSetCompleted event of the mod deletion mod deativator.

DeleteXMLInstalledFile ( IMod p_modMod ) : void

If the mod is scripted, deletes the XMLInstalledFiles file inside the InstallInfo\Scripted folder.

ModManager ( IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ActivateModsMonitor p_ammMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mdrManagedModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager ) : System

A simple constructor that initializes the object with its dependencies.

Method Details

ActivateMod() public method

Activates the given mod.
public ActivateMod ( IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList p_rolActiveMods ) : IBackgroundTaskSet
p_modMod IMod The mod to activate.
p_dlgUpgradeConfirmationDelegate ConfirmModUpgradeDelegate The delegate that is called to confirm whether an upgrade install should be performed.
p_dlgOverwriteConfirmationDelegate ConfirmItemOverwriteDelegate The method to call in order to confirm an overwrite.
p_rolActiveMods ReadOnlyObservableList The list or Active mods.
return IBackgroundTaskSet

AddMod() public method

Installs the specified mod.
public AddMod ( string p_strPath, ConfirmOverwriteCallback p_cocConfirmOverwrite ) : IBackgroundTask
p_strPath string The path to the mod to install.
p_cocConfirmOverwrite ConfirmOverwriteCallback The delegate to call to resolve conflicts with existing files.
return IBackgroundTask

AsyncAddMod() public method

public AsyncAddMod ( Uri p_uriPath, ConfirmOverwriteCallback p_cocConfirmOverwrite ) : IBackgroundTask
p_uriPath System.Uri
p_cocConfirmOverwrite ConfirmOverwriteCallback
return IBackgroundTask

AsyncAddModTask() public method

public AsyncAddModTask ( IBackgroundTask p_tskAddModTask ) : void
p_tskAddModTask IBackgroundTask
return void

AsyncEndorseMod() public method

Async toggle of the endorsement for the given mod.
public AsyncEndorseMod ( IMod p_modMod ) : void
p_modMod IMod The mod to endorse/unendorse.
return void

AsyncTagMod() public method

public AsyncTagMod ( ModManagement p_ModManagerVM, ModManagement p_ModTaggerVM, EventHandler p_TaggingMod ) : void
p_ModManagerVM ModManagement
p_ModTaggerVM ModManagement
p_TaggingMod EventHandler
return void

AsyncUpdateMods() public method

Runs the managed updaters.
public AsyncUpdateMods ( List p_lstModList, ConfirmActionMethod p_camConfirm, bool p_booOverrideCategorySetup ) : void
p_lstModList List The list of mods we need to update.
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
p_booOverrideCategorySetup bool Whether to force a global update.
return void

AsyncUpdateModsTask() public method

public AsyncUpdateModsTask ( ModUpdateCheckTask p_mutModUpdateCheck, ConfirmActionMethod p_camConfirm ) : Task
p_mutModUpdateCheck ModUpdateCheckTask
p_camConfirm ConfirmActionMethod
return Task

DeactivateMod() public method

deactivates the given mod.
public DeactivateMod ( IMod p_modMod, ReadOnlyObservableList p_rolActiveMods ) : IBackgroundTaskSet
p_modMod IMod The mod to deactivate.
p_rolActiveMods ReadOnlyObservableList The list of active mods.
return IBackgroundTaskSet

DeactivateMultipleMods() public method

Runs the managed updaters.
public DeactivateMultipleMods ( ReadOnlyObservableList p_rolModList, ConfirmActionMethod p_camConfirm ) : IBackgroundTask
p_rolModList ReadOnlyObservableList The mod list.
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
return IBackgroundTask

DeleteMod() public method

Deletes the given mod.
The mod is deactivated, unregistered, and then deleted.
public DeleteMod ( IMod p_modMod, ReadOnlyObservableList p_rolActiveMods ) : IBackgroundTaskSet
p_modMod IMod The mod to delete.
p_rolActiveMods ReadOnlyObservableList The list of active mods.
return IBackgroundTaskSet

ForceUpgrade() public method

Forces an upgrade from one mod to another.
No checks as to whether the two mods are actually related are performed. The new mod is reactivated as if it were the old mod, and the old mod is replaced by the new mod.
public ForceUpgrade ( IMod p_modOldMod, IMod p_modNewMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate ) : IBackgroundTaskSet
p_modOldMod IMod The mod from which to upgrade.
p_modNewMod IMod The mod to which to upgrade.
p_dlgOverwriteConfirmationDelegate ConfirmItemOverwriteDelegate The method to call in order to confirm an overwrite.
return IBackgroundTaskSet

GetModTagger() public method

Gets the tagger to use to tag mods with metadata.
public GetModTagger ( ) : AutoTagger
return AutoTagger

Initialize() public static method

Initializes the singleton intances of the mod manager.
Thrown if the mod manager has already /// been initialized.
public static Initialize ( IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ActivateModsMonitor p_ammMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mrgModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager ) : ModManager
p_gmdGameMode IGameMode The current game mode.
p_eifEnvironmentInfo IEnvironmentInfo The application's envrionment info.
p_mrpModRepository IModRepository The mod repository from which to get mods and mod metadata.
p_dmrMonitor Nexus.Client.DownloadMonitoring.DownloadMonitor The download monitor to use to track task progress.
p_ammMonitor Nexus.Client.ActivateModsMonitoring.ActivateModsMonitor
p_frgFormatRegistry IModFormatRegistry The that contains the list /// of supported s.
p_mrgModRegistry ModRegistry The that contains the list /// of managed s.
p_futFileUtility Nexus.Client.Util.FileUtil The file utility class.
p_scxUIContext System.Threading.SynchronizationContext The to use to marshall UI interactions to the UI thread.
p_ilgInstallLog IInstallLog The install log tracking mod activations for the current game mode.
p_pmgPluginManager IPluginManager The plugin manager to use to work with plugins.
return ModManager

LoadQueuedMods() public method

Loads the list of mods that are queued to be added to the mod manager.
public LoadQueuedMods ( ) : void
return void

Login() public method

Logins the user into the current mod repository.
public Login ( ) : bool
return bool

Logout() public method

public Logout ( ) : void
return void

ReactivateMod() public method

Reactivates the given mod.
A reactivation is an upgrade of a mod to itself. It re-runs the activation, without changing the installed precedence of its files and installed values.
public ReactivateMod ( IMod p_modMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate ) : IBackgroundTaskSet
p_modMod IMod The mod to reactivate.
p_dlgOverwriteConfirmationDelegate ConfirmItemOverwriteDelegate The method to call in order to confirm an overwrite.
return IBackgroundTaskSet

Release() public method

This disposes of the singleton object, allowing it to be re-initialized.
public Release ( ) : void
return void

SetupReadMeManager() public method

Runs the managed updaters.
public SetupReadMeManager ( List p_lstModList, ConfirmActionMethod p_camConfirm ) : IBackgroundTask
p_lstModList List The mod list.
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
return IBackgroundTask

SwitchModCategory() public method

Switches the mod category.
public SwitchModCategory ( IMod p_modMod, Int32 p_intCategoryId ) : void
p_modMod IMod The mod.
p_intCategoryId System.Int32 The new category id.
return void

ToggleModEndorsement() public method

Toggles the endorsement for the given mod.
public ToggleModEndorsement ( IMod p_modMod ) : void
p_modMod IMod The mod to endorse/unendorse.
return void

ToggleUpdateWarningTask() public method

Runs the managed updaters.
public ToggleUpdateWarningTask ( HashSet p_hashMods, bool p_booEnable, ConfirmActionMethod p_camConfirm ) : IBackgroundTask
p_hashMods HashSet The hash of mods.
p_booEnable bool Enable/Disable/Toggle.
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
return IBackgroundTask

UpdateMods() public method

Runs the managed updaters.
public UpdateMods ( List p_lstModList, ConfirmActionMethod p_camConfirm, bool p_booOverrideCategorySetup ) : IBackgroundTask
p_lstModList List The list of mods we need to update.
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
p_booOverrideCategorySetup bool Whether to force a global update.
return IBackgroundTask

Property Details

IsBackupActive public property

public bool IsBackupActive
return bool

LoginTask public property

The loginform Task.
public LoginFormTask LoginTask
return LoginFormTask

lstMBInfo public property

public List lstMBInfo
return List