C# Class Nexus.Client.PluginManagement.PluginManager

The class the encapsulates managing plugins.
The list of managed plugins needs to be centralized to ensure integrity; having multiple managers, each with a potentially different list of managed plugins, 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.
Inheritance: IPluginManager
Mostra file Open project: NexusMods/NexusModManager-4.5

Public Methods

Method Description
ActivatePlugin ( Plugin p_plgPlugin ) : void

Activates the given plugin.

ActivatePlugin ( string p_strPath ) : void

Activates the specified plugin.

AddPlugin ( string p_strPluginPath ) : bool

Adds the specified plugin to the list of managed plugins.

AutoPluginSorting ( ConfirmActionMethod p_camConfirm ) : IBackgroundTask

Automatically sorts the managed plugins.

CanActivatePlugins ( ) : bool

Determines if the game mode can handle more active plugins.

CanChangeActiveState ( Plugin p_plgPlugin ) : bool

Determines if the active state of the given plugin can be changed.

DeactivatePlugin ( Plugin p_plgPlugin ) : void

Deactivates the given plugin.

DeactivatePlugin ( string p_strPath ) : void

Deactivates the specified plugin.

GetPluginOrderIndex ( Plugin p_plgPlugin ) : Int32

Gets the load order of the specifid plugin.

GetRegisteredPlugin ( string p_strPath ) : Plugin

Gets the specified plugin.

Initialize ( IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator ) : IPluginManager

Initializes the singleton intances of the mod manager.

IsActivatiblePluginFile ( string p_strPath ) : bool

Determines if the specified file is a plugin that can be activated for the game mode.

IsPluginActive ( string p_strPath ) : bool

Determines if the specified plugin is active.

IsPluginRegistered ( string p_strPath ) : bool

Determines if the specified plugin is registered.

ManageMultiplePluginsTask ( List p_lstPlugins, bool p_booEnable, ConfirmActionMethod p_camConfirm ) : IBackgroundTask

Runs the managed updaters.

Release ( ) : void

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

RemovePlugin ( Plugin p_plgPlugin ) : void

Removes the given plugin from the list of managed plugins.

RemovePlugin ( string p_strPluginPath ) : void

Removes the specified plugin from the list of managed plugins.

SetPluginActivation ( string p_strPath, bool p_booActive ) : void

Sets the activations status of the specified plugin.

SetPluginOrder ( IList p_lstOrderedPlugins ) : void

Sets the order of the plugins to the given order.

If the given list does not include all registered plugins, then the plugins are ordered in a manner so as to not displace the positions of the plugins whose order was not specified.

SetPluginOrderIndex ( Plugin p_plgPlugin, int p_intNewIndex ) : void

Sets the load order of the specifid plugin.

ValidateOrder ( IList p_lstPlugins ) : bool

Determines if the specified plugin order is valid.

Private Methods

Method Description
PluginManager ( IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator ) : System

A simple constructor that initializes the object with its dependencies.

Method Details

ActivatePlugin() public method

Activates the given plugin.
public ActivatePlugin ( Plugin p_plgPlugin ) : void
p_plgPlugin Nexus.Client.Plugins.Plugin The plugin to activate.
return void

ActivatePlugin() public method

Activates the specified plugin.
public ActivatePlugin ( string p_strPath ) : void
p_strPath string The path to the plugin to activate.
return void

AddPlugin() public method

Adds the specified plugin to the list of managed plugins.
public AddPlugin ( string p_strPluginPath ) : bool
p_strPluginPath string The path to the plugin to add.
return bool

AutoPluginSorting() public method

Automatically sorts the managed plugins.
public AutoPluginSorting ( ConfirmActionMethod p_camConfirm ) : IBackgroundTask
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
return IBackgroundTask

CanActivatePlugins() public method

Determines if the game mode can handle more active plugins.
public CanActivatePlugins ( ) : bool
return bool

CanChangeActiveState() public method

Determines if the active state of the given plugin can be changed.
public CanChangeActiveState ( Plugin p_plgPlugin ) : bool
p_plgPlugin Nexus.Client.Plugins.Plugin The plugin for which it is to be determined if the active state can be changed.
return bool

DeactivatePlugin() public method

Deactivates the given plugin.
public DeactivatePlugin ( Plugin p_plgPlugin ) : void
p_plgPlugin Nexus.Client.Plugins.Plugin The plugin to deactivate.
return void

DeactivatePlugin() public method

Deactivates the specified plugin.
public DeactivatePlugin ( string p_strPath ) : void
p_strPath string The path to the plugin to deactivate.
return void

GetPluginOrderIndex() public method

Gets the load order of the specifid plugin.
public GetPluginOrderIndex ( Plugin p_plgPlugin ) : Int32
p_plgPlugin Nexus.Client.Plugins.Plugin The plugin whose load order is to be returned.
return System.Int32

GetRegisteredPlugin() public method

Gets the specified plugin.
public GetRegisteredPlugin ( string p_strPath ) : Plugin
p_strPath string The path of the plugin to retrieve.
return Nexus.Client.Plugins.Plugin

Initialize() public static method

Initializes the singleton intances of the mod manager.
Thrown if the plugin manager has already /// been initialized.
public static Initialize ( IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator ) : IPluginManager
p_gmdGameMode IGameMode The current game mode.
p_mprManagedPluginRegistry PluginRegistry The that contains the list /// of managed s.
p_aplPluginLog Nexus.Client.PluginManagement.InstallationLog.ActivePluginLog The tracking plugin activations for the /// current game mode.
p_polOrderLog IPluginOrderLog The tracking plugin order for the /// current game mode.
p_povOrderValidator IPluginOrderValidator The object that validates plugin order.
return IPluginManager

IsActivatiblePluginFile() public method

Determines if the specified file is a plugin that can be activated for the game mode.
public IsActivatiblePluginFile ( string p_strPath ) : bool
p_strPath string The path to the file for which it is to be determined if it is a plugin file.
return bool

IsPluginActive() public method

Determines if the specified plugin is active.
public IsPluginActive ( string p_strPath ) : bool
p_strPath string The path to the plugin whose active status is to be determined.
return bool

IsPluginRegistered() public method

Determines if the specified plugin is registered.
public IsPluginRegistered ( string p_strPath ) : bool
p_strPath string The path to the plugin whose registration status is to be determined.
return bool

ManageMultiplePluginsTask() public method

Runs the managed updaters.
public ManageMultiplePluginsTask ( List p_lstPlugins, bool p_booEnable, ConfirmActionMethod p_camConfirm ) : IBackgroundTask
p_lstPlugins List
p_booEnable bool Enable/Disable/Toggle.
p_camConfirm ConfirmActionMethod The delegate to call to confirm an action.
return IBackgroundTask

Release() public method

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

RemovePlugin() public method

Removes the given plugin from the list of managed plugins.
public RemovePlugin ( Plugin p_plgPlugin ) : void
p_plgPlugin Nexus.Client.Plugins.Plugin The plugin to remove.
return void

RemovePlugin() public method

Removes the specified plugin from the list of managed plugins.
public RemovePlugin ( string p_strPluginPath ) : void
p_strPluginPath string The path to the plugin to remove.
return void

SetPluginActivation() public method

Sets the activations status of the specified plugin.
public SetPluginActivation ( string p_strPath, bool p_booActive ) : void
p_strPath string The path to the plugin whose status is to be set.
p_booActive bool Whether to activate the plugin, or deactivate it.
return void

SetPluginOrder() public method

Sets the order of the plugins to the given order.
If the given list does not include all registered plugins, then the plugins are ordered in a manner so as to not displace the positions of the plugins whose order was not specified.
public SetPluginOrder ( IList p_lstOrderedPlugins ) : void
p_lstOrderedPlugins IList The list indicating the desired order of the plugins.
return void

SetPluginOrderIndex() public method

Sets the load order of the specifid plugin.
public SetPluginOrderIndex ( Plugin p_plgPlugin, int p_intNewIndex ) : void
p_plgPlugin Nexus.Client.Plugins.Plugin The plugin whose load order is to be set.
p_intNewIndex int The new load order index of the plugin.
return void

ValidateOrder() public method

Determines if the specified plugin order is valid.
public ValidateOrder ( IList p_lstPlugins ) : bool
p_lstPlugins IList The plugins whose order is to be validated.
return bool