C# Class Nexus.Client.ModManagement.Scripting.ScriptFunctionProxy

Implements the functions availabe to scripts.
The proxy allows sandboxed scripts to call functions that can perform actions outside of the sandbox.
Inheritance: System.MarshalByRefObject
Afficher le fichier Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Méthodes publiques

Méthode Description
DataFileExists ( string p_strPath ) : bool

Determines if the specified file exists in the user's Data directory.

EditIni ( string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : bool

Sets the specified value in the specified Ini file to the given value.

ExtendedMessageBox ( string p_strMessage, string p_strTitle, string p_strDetails, MessageBoxButtons p_mbbButtons, MessageBoxIcon p_mdiIcon ) : DialogResult

Shows an extended message box with the given message, title, details, buttons, and icon.

GenerateDataFile ( string p_strPath, byte p_bteData ) : bool

Writes the file represented by the given byte array to the given path.

This method writes the given data as a file at the given path. If the file already exists the user is prompted to overwrite the file.

GetActivePlugins ( ) : string[]

Retrieves a list of currently active plugins.

GetAllPlugins ( ) : string[]

Gets a list of all installed plugins.

GetExistingDataFile ( string p_strPath ) : byte[]

Gets the speified file from the user's Data directory.

GetExistingDataFileList ( string p_strPath, string p_strPattern, bool p_booAllFolders ) : string[]

Gets a filtered list of all files in a user's Data directory.

GetFileFromMod ( string p_strFile ) : byte[]

Retrieves the specified file from the mod.

GetGameVersion ( ) : System.Version

Gets the version of the game that is installed.

GetIniInt ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : Int32

Retrieves the specified settings value as an integer.

GetIniString ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : string

Retrieves the specified settings value as a string.

GetModFileList ( ) : string[]

Retrieves the list of files in the mod.

GetModFileList ( string p_strFolder, bool p_booRecurse ) : string[]

Retrieves the list of files in the specified folder in the mod.

GetModManagerVersion ( ) : System.Version

Gets the version of the mod manager.

InstallFileFromMod ( string p_strFile ) : bool

Installs the speified file from the mod to the file system.

InstallFileFromMod ( string p_strFrom, string p_strTo ) : bool

Installs the specified file from the mod to the specified location on the file system.

InstallFolderFromMod ( string p_strFrom, bool p_booRecurse ) : bool

Installs the files in the specified folder from the mod to the file system.

InstallFolderFromMod ( string p_strFrom, string p_strTo, bool p_booRecurse ) : bool

Installs the files in the specified folder from the mod to the specified location on the file system.

MessageBox ( string p_strMessage, string p_strTitle, MessageBoxButtons p_mbbButtons ) : DialogResult

Shows a message box with the given message, title, and buttons.

MessageBox ( string p_strMessage, string p_strTitle, MessageBoxButtons p_mbbButtons, MessageBoxIcon p_mdiIcon ) : DialogResult

Shows a message box with the given message, title, buttons, and icon.

MessageBox ( string p_strMessage ) : void

Shows a message box with the given message.

MessageBox ( string p_strMessage, string p_strTitle ) : void

Shows a message box with the given message and title.

PerformBasicInstall ( ) : bool

Performs a basic install of the mod.

A basic install installs all of the file in the mod to the Data directory or activates all esp and esm files.

ScriptFunctionProxy ( IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, UIUtil p_uipUIProxy ) : System

A simple constructor that initializes the object with the given values.

Select ( IList p_lstOptions, string p_strTitle, bool p_booSelectMany ) : string[]

Displays a selection form to the user.

SetDeactivationWarning ( string p_strPlugin, string p_strWarningType ) : void

Registers a warning to be displayed when the user deactivates the specified plugin in the mod manager.

This method is ignored. Registering warnings is not supported by the currect implementation of the mod manager.

SetLoadOrder ( int p_intPlugins ) : void

Sets the load order of the plugins.

Each plugin will be moved from its current index to its indices' position in p_intPlugins.

SetLoadOrder ( int p_intPlugins, int p_intPosition ) : void

Moves the specified plugins to the given position in the load order.

Note that the order of the given list of plugins is not maintained. They are re-ordered to be in the same order as they are in the before-operation load order. This, I think, is somewhat counter-intuitive and may change, though likely not so as to not break backwards compatibility.

SetPluginActivation ( string p_strPluginPath, bool p_booActivate ) : void

Sets the activated status of a plugin (i.e., and esp or esm file).

SetPluginOrderIndex ( string p_strPlugin, int p_intNewIndex ) : void

Sets the load order of the specifid plugin.

SetRelativeLoadOrder ( string p_strRelativelyOrderedPlugins ) : void

Orders the plugins such that the specified plugins are in the specified order.

The given plugins may not end up consecutively ordered.

Méthodes protégées

Méthode Description
DoSetLoadOrder ( int p_intPlugins ) : void

Sets the load order of the plugins.

Each plugin will be moved from its current index to its indices' position in p_intPlugins.

DoSetLoadOrder ( int p_intPlugins, int p_intPosition ) : void

Moves the specified plugins to the given position in the load order.

Note that the order of the given list of plugins is not maintained. They are re-ordered to be in the same order as they are in the before-operation load order. This, I think, is somewhat counter-intuitive and may change, though likely not so as to not break backwards compatibility.

DoSetPluginOrderIndex ( string p_strPlugin, int p_intNewIndex ) : void

Sets the load order of the specifid plugin.

OnTaskStarted ( EventArgs e ) : void

Raises the TaskStarted event.

OnTaskStarted ( IBackgroundTask p_bgtTask ) : void

Raises the TaskStarted event.

RelativizePluginPaths ( IList p_lstPlugins ) : string[]

The returns a list of the paths of the given plugins, relative to the game mode's installation path.

Private Methods

Méthode Description
SaveXMLInstalledFiles ( string p_strFrom, string p_strTo ) : void

Create the XML file with the Install Files list (From the rar to the folder).

SetDeactivationWarning ( string p_strPlugin, DeactivationWarningType p_dwtWarningType ) : void

Registers a warning to be displayed when the user deactivates the specified plugin in the mod manager.

This method is ignored. Registering warnings is not supported by the currect implementation of the mod manager.

Method Details

DataFileExists() public méthode

Determines if the specified file exists in the user's Data directory.
public DataFileExists ( string p_strPath ) : bool
p_strPath string The path of the file whose existence is to be verified.
Résultat bool

DoSetLoadOrder() protected méthode

Sets the load order of the plugins.
Each plugin will be moved from its current index to its indices' position in p_intPlugins.
protected DoSetLoadOrder ( int p_intPlugins ) : void
p_intPlugins int The new load order of the plugins. Each entry in this array /// contains the current index of a plugin. This array must contain all current indices.
Résultat void

DoSetLoadOrder() protected méthode

Moves the specified plugins to the given position in the load order.
Note that the order of the given list of plugins is not maintained. They are re-ordered to be in the same order as they are in the before-operation load order. This, I think, is somewhat counter-intuitive and may change, though likely not so as to not break backwards compatibility.
protected DoSetLoadOrder ( int p_intPlugins, int p_intPosition ) : void
p_intPlugins int The list of plugins to move to the given position in the /// load order. Each entry in this array contains the current index of a plugin.
p_intPosition int The position in the load order to which to move the specified /// plugins.
Résultat void

DoSetPluginOrderIndex() protected méthode

Sets the load order of the specifid plugin.
protected DoSetPluginOrderIndex ( string p_strPlugin, int p_intNewIndex ) : void
p_strPlugin string The path to the plugin file whose load order is to be set.
p_intNewIndex int The new load order index of the plugin.
Résultat void

EditIni() public méthode

Sets the specified value in the specified Ini file to the given value.
public EditIni ( string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : bool
p_strSettingsFileName string The name of the settings file to edit.
p_strSection string The section in the Ini file to edit.
p_strKey string The key in the Ini file to edit.
p_strValue string The value to which to set the key.
Résultat bool

ExtendedMessageBox() public méthode

Shows an extended message box with the given message, title, details, buttons, and icon.
public ExtendedMessageBox ( string p_strMessage, string p_strTitle, string p_strDetails, MessageBoxButtons p_mbbButtons, MessageBoxIcon p_mdiIcon ) : DialogResult
p_strMessage string The message to display in the message box.
p_strTitle string The message box's title, displayed in the title bar.
p_strDetails string The message box's details, displayed in the details area.
p_mbbButtons MessageBoxButtons The buttons to show in the message box.
p_mdiIcon MessageBoxIcon The icon to display in the message box.
Résultat DialogResult

GenerateDataFile() public méthode

Writes the file represented by the given byte array to the given path.
This method writes the given data as a file at the given path. If the file already exists the user is prompted to overwrite the file.
public GenerateDataFile ( string p_strPath, byte p_bteData ) : bool
p_strPath string The path where the file is to be created.
p_bteData byte The data that is to make up the file.
Résultat bool

GetActivePlugins() public méthode

Retrieves a list of currently active plugins.
public GetActivePlugins ( ) : string[]
Résultat string[]

GetAllPlugins() public méthode

Gets a list of all installed plugins.
public GetAllPlugins ( ) : string[]
Résultat string[]

GetExistingDataFile() public méthode

Gets the speified file from the user's Data directory.
public GetExistingDataFile ( string p_strPath ) : byte[]
p_strPath string The path of the file to retrieve.
Résultat byte[]

GetExistingDataFileList() public méthode

Gets a filtered list of all files in a user's Data directory.
public GetExistingDataFileList ( string p_strPath, string p_strPattern, bool p_booAllFolders ) : string[]
p_strPath string The subdirectory of the Data directory from which to get the listing.
p_strPattern string The pattern against which to filter the file paths.
p_booAllFolders bool Whether or not to search through subdirectories.
Résultat string[]

GetFileFromMod() public méthode

Retrieves the specified file from the mod.
public GetFileFromMod ( string p_strFile ) : byte[]
p_strFile string The file to retrieve.
Résultat byte[]

GetGameVersion() public méthode

Gets the version of the game that is installed.
public GetGameVersion ( ) : System.Version
Résultat System.Version

GetIniInt() public méthode

Retrieves the specified settings value as an integer.
public GetIniInt ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : Int32
p_strSettingsFileName string The name of the settings file from which to retrieve the value.
p_strSection string The section containing the value to retrieve.
p_strKey string The key of the value to retrieve.
Résultat System.Int32

GetIniString() public méthode

Retrieves the specified settings value as a string.
public GetIniString ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : string
p_strSettingsFileName string The name of the settings file from which to retrieve the value.
p_strSection string The section containing the value to retrieve.
p_strKey string The key of the value to retrieve.
Résultat string

GetModFileList() public méthode

Retrieves the list of files in the mod.
public GetModFileList ( ) : string[]
Résultat string[]

GetModFileList() public méthode

Retrieves the list of files in the specified folder in the mod.
public GetModFileList ( string p_strFolder, bool p_booRecurse ) : string[]
p_strFolder string The folder whose file list is to be retrieved.
p_booRecurse bool Whether to return files that are in subdirectories of the given directory.
Résultat string[]

GetModManagerVersion() public méthode

Gets the version of the mod manager.
public GetModManagerVersion ( ) : System.Version
Résultat System.Version

InstallFileFromMod() public méthode

Installs the speified file from the mod to the file system.
public InstallFileFromMod ( string p_strFile ) : bool
p_strFile string The path of the file to install.
Résultat bool

InstallFileFromMod() public méthode

Installs the specified file from the mod to the specified location on the file system.
public InstallFileFromMod ( string p_strFrom, string p_strTo ) : bool
p_strFrom string The path of the file in the mod to install.
p_strTo string The path on the file system where the file is to be created.
Résultat bool

InstallFolderFromMod() public méthode

Installs the files in the specified folder from the mod to the file system.
public InstallFolderFromMod ( string p_strFrom, bool p_booRecurse ) : bool
p_strFrom string The path of the folder in the mod containing the files to install.
p_booRecurse bool Whether to install all files in all subfolders.
Résultat bool

InstallFolderFromMod() public méthode

Installs the files in the specified folder from the mod to the specified location on the file system.
public InstallFolderFromMod ( string p_strFrom, string p_strTo, bool p_booRecurse ) : bool
p_strFrom string The path of the folder in the mod containing the files to install.
p_strTo string The path on the file system where the files are to be created.
p_booRecurse bool Whether to install all files in all subfolders.
Résultat bool

MessageBox() public méthode

Shows a message box with the given message, title, and buttons.
public MessageBox ( string p_strMessage, string p_strTitle, MessageBoxButtons p_mbbButtons ) : DialogResult
p_strMessage string The message to display in the message box.
p_strTitle string The message box's title, display in the title bar.
p_mbbButtons MessageBoxButtons The buttons to show in the message box.
Résultat DialogResult

MessageBox() public méthode

Shows a message box with the given message, title, buttons, and icon.
public MessageBox ( string p_strMessage, string p_strTitle, MessageBoxButtons p_mbbButtons, MessageBoxIcon p_mdiIcon ) : DialogResult
p_strMessage string The message to display in the message box.
p_strTitle string The message box's title, display in the title bar.
p_mbbButtons MessageBoxButtons The buttons to show in the message box.
p_mdiIcon MessageBoxIcon The icon to display in the message box.
Résultat DialogResult

MessageBox() public méthode

Shows a message box with the given message.
public MessageBox ( string p_strMessage ) : void
p_strMessage string The message to display in the message box.
Résultat void

MessageBox() public méthode

Shows a message box with the given message and title.
public MessageBox ( string p_strMessage, string p_strTitle ) : void
p_strMessage string The message to display in the message box.
p_strTitle string The message box's title, display in the title bar.
Résultat void

OnTaskStarted() protected méthode

Raises the TaskStarted event.
protected OnTaskStarted ( EventArgs e ) : void
e EventArgs An describing the task that was started.
Résultat void

OnTaskStarted() protected méthode

Raises the TaskStarted event.
protected OnTaskStarted ( IBackgroundTask p_bgtTask ) : void
p_bgtTask IBackgroundTask The task that was started.
Résultat void

PerformBasicInstall() public méthode

Performs a basic install of the mod.
A basic install installs all of the file in the mod to the Data directory or activates all esp and esm files.
public PerformBasicInstall ( ) : bool
Résultat bool

RelativizePluginPaths() protected méthode

The returns a list of the paths of the given plugins, relative to the game mode's installation path.
protected RelativizePluginPaths ( IList p_lstPlugins ) : string[]
p_lstPlugins IList The plugins whose paths are to be made relative.
Résultat string[]

ScriptFunctionProxy() public méthode

A simple constructor that initializes the object with the given values.
public ScriptFunctionProxy ( IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, InstallerGroup p_igpInstallers, UIUtil p_uipUIProxy ) : System
p_modMod IMod The mod for which the script is running.
p_gmdGameMode IGameMode The game mode currently being managed.
p_eifEnvironmentInfo IEnvironmentInfo The application's envrionment info.
p_igpInstallers InstallerGroup The utility class to use to install the mod items.
p_uipUIProxy UIUtil The UI manager to use to interact with UI elements.
Résultat System

Select() public méthode

Displays a selection form to the user.
public Select ( IList p_lstOptions, string p_strTitle, bool p_booSelectMany ) : string[]
p_lstOptions IList The options from which to select.
p_strTitle string The title of the selection form.
p_booSelectMany bool Whether more than one items can be selected.
Résultat string[]

SetDeactivationWarning() public méthode

Registers a warning to be displayed when the user deactivates the specified plugin in the mod manager.
This method is ignored. Registering warnings is not supported by the currect implementation of the mod manager.
public SetDeactivationWarning ( string p_strPlugin, string p_strWarningType ) : void
p_strPlugin string The plugin for which to register a warning.
p_strWarningType string The type of warning to register.
Résultat void

SetLoadOrder() public méthode

Sets the load order of the plugins.
Each plugin will be moved from its current index to its indices' position in p_intPlugins.
public SetLoadOrder ( int p_intPlugins ) : void
p_intPlugins int The new load order of the plugins. Each entry in this array /// contains the current index of a plugin. This array must contain all current indices.
Résultat void

SetLoadOrder() public méthode

Moves the specified plugins to the given position in the load order.
Note that the order of the given list of plugins is not maintained. They are re-ordered to be in the same order as they are in the before-operation load order. This, I think, is somewhat counter-intuitive and may change, though likely not so as to not break backwards compatibility.
public SetLoadOrder ( int p_intPlugins, int p_intPosition ) : void
p_intPlugins int The list of plugins to move to the given position in the /// load order. Each entry in this array contains the current index of a plugin.
p_intPosition int The position in the load order to which to move the specified /// plugins.
Résultat void

SetPluginActivation() public méthode

Sets the activated status of a plugin (i.e., and esp or esm file).
public SetPluginActivation ( string p_strPluginPath, bool p_booActivate ) : void
p_strPluginPath string The path to the plugin to activate or deactivate.
p_booActivate bool Whether to activate the plugin.
Résultat void

SetPluginOrderIndex() public méthode

Sets the load order of the specifid plugin.
public SetPluginOrderIndex ( string p_strPlugin, int p_intNewIndex ) : void
p_strPlugin string The path to the plugin file whose load order is to be set.
p_intNewIndex int The new load order index of the plugin.
Résultat void

SetRelativeLoadOrder() public méthode

Orders the plugins such that the specified plugins are in the specified order.
The given plugins may not end up consecutively ordered.
public SetRelativeLoadOrder ( string p_strRelativelyOrderedPlugins ) : void
p_strRelativelyOrderedPlugins string The plugins to order relative to one another.
Résultat void