C# Class Nexus.Client.ModManagement.ModFileInstaller

This installs mod files.
Inheritance: IModFileInstaller
显示文件 Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Methods

Method Description
FinalizeInstall ( ) : void

Finalizes the installation of the files.

GenerateDataFile ( string p_strPath, byte p_bteData, bool p_booSecondaryInstallPath ) : 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.

InstallFileFromMod ( string p_strModFilePath, string p_strInstallPath, bool p_booSecondaryInstallPath ) : bool

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

IsFileLocked ( string filePath ) : bool

Check if the file is in use.

ModFileInstaller ( IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins, ModManager p_mmModManager ) : System

A simple constructor that initializes the object with its dependencies.

UninstallDataFile ( string p_strPath, bool p_booSecondaryInstallPath ) : void

Uninstalls the specified file.

If the mod we are uninstalling doesn't own the file, then its version is removed from the overwrites directory. If the mod we are uninstalling overwrote a file when it installed the specified file, then the overwritten file is restored. Otherwise the file is deleted.

Protected Methods

Method Description
TestDoOverwrite ( string p_strPath ) : bool

Verifies if the given file can be written.

This method checks if the given path is valid. If so, and the file does not exist, the file can be written. If the file does exist, than the user is asked to overwrite the file.

TrimEmptyDirectories ( string p_strStartPath, string p_strStopDirectory ) : void

Deletes any empty directories found between the start path and the end directory.

Method Details

FinalizeInstall() public method

Finalizes the installation of the files.
public FinalizeInstall ( ) : void
return void

GenerateDataFile() public method

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.
Thrown if is /// not safe.
public GenerateDataFile ( string p_strPath, byte p_bteData, bool p_booSecondaryInstallPath ) : 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.
p_booSecondaryInstallPath bool Whether to use the secondary install path.
return bool

InstallFileFromMod() public method

Installs the speified file from the Mod to the file system.
public InstallFileFromMod ( string p_strModFilePath, string p_strInstallPath, bool p_booSecondaryInstallPath ) : bool
p_strModFilePath string The path of the file in the Mod to install.
p_strInstallPath string The path on the file system where the file is to be installed.
p_booSecondaryInstallPath bool Whether to use the secondary install path.
return bool

IsFileLocked() public method

Check if the file is in use.
public IsFileLocked ( string filePath ) : bool
filePath string
return bool

ModFileInstaller() public method

A simple constructor that initializes the object with its dependencies.
public ModFileInstaller ( IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins, ModManager p_mmModManager ) : System
p_gmiGameModeInfo IGameModeEnvironmentInfo The environment info of the current game mode.
p_modMod IMod The mod being installed.
p_ilgInstallLog IInstallLog The install log to use to log file installations.
p_pmgPluginManager IPluginManager The plugin manager.
p_dfuDataFileUtility IDataFileUtil The utility class to use to work with data files.
p_tfmFileManager ChinhDo.Transactions.TxFileManager The transactional file manager to use to interact with the file system.
p_dlgOverwriteConfirmationDelegate ConfirmItemOverwriteDelegate The method to call in order to confirm an overwrite.
p_UsesPlugins bool Whether the file is a mod or a plugin.
p_mmModManager ModManager
return System

TestDoOverwrite() protected method

Verifies if the given file can be written.
This method checks if the given path is valid. If so, and the file does not exist, the file can be written. If the file does exist, than the user is asked to overwrite the file.
protected TestDoOverwrite ( string p_strPath ) : bool
p_strPath string The file path, relative to the Data folder, whose writability is to be verified.
return bool

TrimEmptyDirectories() protected method

Deletes any empty directories found between the start path and the end directory.
protected TrimEmptyDirectories ( string p_strStartPath, string p_strStopDirectory ) : void
p_strStartPath string The path from which to start looking for empty directories.
p_strStopDirectory string The directory at which to stop looking.
return void

UninstallDataFile() public method

Uninstalls the specified file.
If the mod we are uninstalling doesn't own the file, then its version is removed from the overwrites directory. If the mod we are uninstalling overwrote a file when it installed the specified file, then the overwritten file is restored. Otherwise the file is deleted.
public UninstallDataFile ( string p_strPath, bool p_booSecondaryInstallPath ) : void
p_strPath string The path to the file that is to be uninstalled.
p_booSecondaryInstallPath bool Whether to use the secondary install path.
return void