C# Class Nexus.Client.Mods.Formats.FOMod.FOMod

Encapsulates a FOMod mod archive.
Inheritance: ObservableObject, IMod
Exibir arquivo Open project: NexusMods/NexusModManager-4.5

Protected Properties

Property Type Description
IgnoreFolders List

Public Methods

Method Description
BeginReadOnlyTransaction ( FileUtil p_futFileUtil ) : void

Starts a read-only transaction.

This puts the FOMod into read-only mode. Read-only mode can greatly increase the speed at which multiple file are extracted.

CompareOrderFoldersFirst ( string x, string y ) : int
ContainsFile ( string p_strPath ) : bool

Determines if the FOMod contains the given file.

EndReadOnlyTransaction ( ) : void

Ends a read-only transaction.

This takes the FOMod out of read-only mode. Read-only mode can greatly increase the speed at which multiple file are extracted.

FOMod ( string p_strFilePath, FOModFormat p_mftModFormat, IEnumerable p_enmStopFolders, string p_strPluginsDirectoryName, IEnumerable p_enmPluginExtensions, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry, bool p_booUsePlugins ) : System

A simple constructor that initializes the FOMod from the specified file.

GetFile ( string p_strFile ) : byte[]

Retrieves the specified file from the fomod.

GetFileList ( ) : List

Retrieves the list of files in this FOMod.

GetFileList ( string p_strFolderPath, bool p_booRecurse ) : List

Retrieves the list of all files in the specified FOMod folder.

IsMatchingVersion ( ) : bool

Determines if last known version is the same as the current version.

ToString ( ) : string

Uses the mod name to represent the mod.

UpdateInfo ( IModInfo p_mifInfo, bool p_booOverwriteAllValues ) : void

Updates the object's properties to the values of the given IModInfo.

Protected Methods

Method Description
CreateOrReplaceFile ( string p_strPath, byte p_bteData ) : void

Replaces the specified file with the given data.

DeleteFile ( string p_strPath ) : void

Deletes the specified file.

FindPathPrefix ( ) : void

This finds where in the archive the FOMod file structure begins.

This methods finds the path prefix to the folder containing the core files and folders of the FOMod. If there are any files that are above the core folder, than they are given new file names inside the core folder.

GetRealPath ( string p_strPath ) : string

This method adjusts the given virtual path to the actual path to the file in the mod.

This method account for the virtual restructuring of the mod file structure performed by FindPathPrefix().

LoadInfo ( ) : void

Loads the mod metadata from the info file.

LoadInfo ( XmlNode p_xndInfo, bool p_booFillOnlyEmptyValues ) : void

Deserializes an IModInfo from the given XML fragment.

ReplaceFile ( string p_strPath, byte p_bteData ) : void

Replaces the specified file with the given data.

ReplaceFile ( string p_strPath, string p_strData ) : void

Replaces the specified file with the given text.

SaveInfo ( XmlDocument p_xmlDocument ) : XmlNode

Serializes this IModInfo to an XML fragment.

Private Methods

Method Description
ArchiveFile_ReadOnlyInitProgressUpdated ( object sender, CancelProgressEventArgs e ) : void

Handles the Archive.ReadOnlyInitProgressUpdated event of the mod's archive file.

This raises the mod's ReadOnlyInitProgressUpdated event.

Archive_FilesChanged ( object sender, EventArgs e ) : void

Handles the Archive.FilesChanged event of the FOMod's archive.

This ensures that the path prefix that points to the folder in the archive that contains the core files and folders of the FOMod is updated when the archive changes.

InitializeMovedArchive ( string p_strPathPrefix ) : string

Method Details

BeginReadOnlyTransaction() public method

Starts a read-only transaction.
This puts the FOMod into read-only mode. Read-only mode can greatly increase the speed at which multiple file are extracted.
public BeginReadOnlyTransaction ( FileUtil p_futFileUtil ) : void
p_futFileUtil Nexus.Client.Util.FileUtil
return void

CompareOrderFoldersFirst() public static method

public static CompareOrderFoldersFirst ( string x, string y ) : int
x string
y string
return int

ContainsFile() public method

Determines if the FOMod contains the given file.
public ContainsFile ( string p_strPath ) : bool
p_strPath string The filename whose existence in the FOMod is to be determined.
return bool

CreateOrReplaceFile() protected method

Replaces the specified file with the given data.
protected CreateOrReplaceFile ( string p_strPath, byte p_bteData ) : void
p_strPath string The path of the file to replace.
p_bteData byte The new file data.
return void

DeleteFile() protected method

Deletes the specified file.
protected DeleteFile ( string p_strPath ) : void
p_strPath string The path of the file to delete.
return void

EndReadOnlyTransaction() public method

Ends a read-only transaction.
This takes the FOMod out of read-only mode. Read-only mode can greatly increase the speed at which multiple file are extracted.
public EndReadOnlyTransaction ( ) : void
return void

FOMod() public method

A simple constructor that initializes the FOMod from the specified file.
public FOMod ( string p_strFilePath, FOModFormat p_mftModFormat, IEnumerable p_enmStopFolders, string p_strPluginsDirectoryName, IEnumerable p_enmPluginExtensions, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry, bool p_booUsePlugins ) : System
p_strFilePath string The mod file from which to create the FOMod.
p_mftModFormat FOModFormat The format of the mod.
p_enmStopFolders IEnumerable
p_strPluginsDirectoryName string The name of the folder that contains plugins.
p_enmPluginExtensions IEnumerable
p_mcmModCacheManager IModCacheManager The manager for the current game mode's mod cache.
p_stgScriptTypeRegistry IScriptTypeRegistry The registry of supported script types.
p_booUsePlugins bool
return System

FindPathPrefix() protected method

This finds where in the archive the FOMod file structure begins.
This methods finds the path prefix to the folder containing the core files and folders of the FOMod. If there are any files that are above the core folder, than they are given new file names inside the core folder.
protected FindPathPrefix ( ) : void
return void

GetFile() public method

Retrieves the specified file from the fomod.
Thrown if the specified file /// is not in the fomod.
public GetFile ( string p_strFile ) : byte[]
p_strFile string The file to retrieve.
return byte[]

GetFileList() public method

Retrieves the list of files in this FOMod.
public GetFileList ( ) : List
return List

GetFileList() public method

Retrieves the list of all files in the specified FOMod folder.
public GetFileList ( string p_strFolderPath, bool p_booRecurse ) : List
p_strFolderPath string The FOMod folder whose file list is to be retrieved.
p_booRecurse bool Whether to return files that are in subdirectories of the given directory.
return List

GetRealPath() protected method

This method adjusts the given virtual path to the actual path to the file in the mod.
This method account for the virtual restructuring of the mod file structure performed by FindPathPrefix().
protected GetRealPath ( string p_strPath ) : string
p_strPath string The path to adjust.
return string

IsMatchingVersion() public method

Determines if last known version is the same as the current version.
public IsMatchingVersion ( ) : bool
return bool

LoadInfo() protected method

Loads the mod metadata from the info file.
protected LoadInfo ( ) : void
return void

LoadInfo() protected method

Deserializes an IModInfo from the given XML fragment.
protected LoadInfo ( XmlNode p_xndInfo, bool p_booFillOnlyEmptyValues ) : void
p_xndInfo System.Xml.XmlNode The XML fragment from which to deserialize the .
p_booFillOnlyEmptyValues bool Whether to only overwrite null or empty values.
return void

ReplaceFile() protected method

Replaces the specified file with the given data.
protected ReplaceFile ( string p_strPath, byte p_bteData ) : void
p_strPath string The path of the file to replace.
p_bteData byte The new file data.
return void

ReplaceFile() protected method

Replaces the specified file with the given text.
protected ReplaceFile ( string p_strPath, string p_strData ) : void
p_strPath string The path of the file to replace.
p_strData string The new file text.
return void

SaveInfo() protected method

Serializes this IModInfo to an XML fragment.
protected SaveInfo ( XmlDocument p_xmlDocument ) : XmlNode
p_xmlDocument System.Xml.XmlDocument The to use to create the XML elements /// created during the unparsing.
return System.Xml.XmlNode

ToString() public method

Uses the mod name to represent the mod.
public ToString ( ) : string
return string

UpdateInfo() public method

Updates the object's properties to the values of the given IModInfo.
public UpdateInfo ( IModInfo p_mifInfo, bool p_booOverwriteAllValues ) : void
p_mifInfo IModInfo The whose values /// are to be used to update this object's properties.
p_booOverwriteAllValues bool Whether to overwrite the current info values, /// or just the empty ones.
return void

Property Details

IgnoreFolders protected_oe property

protected List IgnoreFolders
return List