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

Encapsulates a OMod mod archive.
Inheritance: ObservableObject, IMod
Mostra file Open project: NexusMods/NexusModManager-4.5

Public Methods

Method Description
BeginReadOnlyTransaction ( FileUtil p_futFileUtil ) : void

Starts a read-only transaction.

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

ContainsFile ( string p_strPath ) : bool

Determines if the OMod contains the given file.

EndReadOnlyTransaction ( ) : void

Ends a read-only transaction.

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

GetFile ( string p_strFile ) : byte[]

Retrieves the specified file from the OMod.

GetFileList ( ) : List

Retrieves the list of files in this OMod.

GetFileList ( string p_strFolderPath, bool p_booRecurse ) : List

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

IsMatchingVersion ( ) : bool

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

OMod ( string p_strFilePath, OModFormat p_mftModFormat, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry ) : System

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

ToString ( ) : string

Uses the mod name to represent to 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
DeleteSpecialFile ( string p_strPath ) : void

Deletes the specified file.

ExtractConfig ( SevenZip.SevenZipExtractor p_szeOmod ) : void

Loads the mod metadata from the config file.

ExtractDataFileList ( SevenZip.SevenZipExtractor p_szeOmod ) : void

Loads the list of data files in the mod.

ExtractPluginList ( SevenZip.SevenZipExtractor p_szeOmod ) : void

Loads the list of plugins in the mod.

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().

GetSpecialFile ( string p_strFile ) : byte[]

Retrieves the specified file from the OMod.

LoadInfo ( byte p_bteData ) : void

Deserializes an IModInfo from the given data.

ReplaceSpecialFile ( string p_strPath, byte p_bteData ) : void

Replaces the specified file with the given data.

ReplaceSpecialFile ( string p_strPath, string p_strData ) : void

Replaces the specified file with the given text.

SaveInfo ( ) : byte[]

Serializes this IModInfo to a data block, suitable to write to a file.

ValidateConfig ( byte p_bteData ) : bool

Validates an OMod config file.

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.

InitializePackedOmod ( IScriptTypeRegistry p_stgScriptTypeRegistry ) : void

Initializes an OMod in packed format.

InitializeUnpackedOmod ( bool p_booUseCache, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry ) : void

Initializes an OMod in OMod-ready archive format.

UpdateFileStreamExtractionProgress ( float p_fltPercentDone ) : void

Updates the progress of the read only initialization while extracting file blocks.

UpdateReadOnlyInitProgress ( float p_fltBasePercent, float p_fltPercentBlockSize, float p_fltPercentDone ) : void

Updates the progress of the read only initialization.

dpwWatcher_ProgressUpdated ( object sender, EventArgs e ) : void

Handles the DecoderProgressWatcher.ProgressUpdated event of the watcher that is monitoring the extraction of compressed files blocks.

szeZip_Extracting ( object sender, SevenZip.ProgressEventArgs e ) : void

Handles the SevenZipExtractor.Extracting event of the extractor that is extracting the compressed files blocks.

Method Details

BeginReadOnlyTransaction() public method

Starts a read-only transaction.
This puts the OMod 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

ContainsFile() public method

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

DeleteSpecialFile() protected method

Deletes the specified file.
protected DeleteSpecialFile ( 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 OMod out of read-only mode. Read-only mode can greatly increase the speed at which multiple file are extracted.
public EndReadOnlyTransaction ( ) : void
return void

ExtractConfig() protected method

Loads the mod metadata from the config file.
protected ExtractConfig ( SevenZip.SevenZipExtractor p_szeOmod ) : void
p_szeOmod SevenZip.SevenZipExtractor The extractor from which to read the config file.
return void

ExtractDataFileList() protected method

Loads the list of data files in the mod.
protected ExtractDataFileList ( SevenZip.SevenZipExtractor p_szeOmod ) : void
p_szeOmod SevenZip.SevenZipExtractor The extractor from which to read the file list.
return void

ExtractPluginList() protected method

Loads the list of plugins in the mod.
protected ExtractPluginList ( SevenZip.SevenZipExtractor p_szeOmod ) : void
p_szeOmod SevenZip.SevenZipExtractor The extractor from which to read the plugin list.
return void

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 OMod.
Thrown if the specified file /// is not in the OMod.
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 OMod.
public GetFileList ( ) : List
return List

GetFileList() public method

Retrieves the list of all files in the specified OMod folder.
public GetFileList ( string p_strFolderPath, bool p_booRecurse ) : List
p_strFolderPath string The OMod 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

GetSpecialFile() protected method

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

IsMatchingVersion() public method

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

LoadInfo() protected method

Deserializes an IModInfo from the given data.
protected LoadInfo ( byte p_bteData ) : void
p_bteData byte The data from which to deserialize the .
return void

OMod() public method

A simple constructor that initializes the OMod from the specified file.
public OMod ( string p_strFilePath, OModFormat p_mftModFormat, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry ) : System
p_strFilePath string The mod file from which to create the OMod.
p_mftModFormat OModFormat The format of the mod.
p_mcmModCacheManager IModCacheManager The manager for the current game mode's mod cache.
p_stgScriptTypeRegistry IScriptTypeRegistry The registry of supported script types.
return System

ReplaceSpecialFile() protected method

Replaces the specified file with the given data.
protected ReplaceSpecialFile ( 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

ReplaceSpecialFile() protected method

Replaces the specified file with the given text.
protected ReplaceSpecialFile ( 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 a data block, suitable to write to a file.
protected SaveInfo ( ) : byte[]
return byte[]

ToString() public method

Uses the mod name to represent to 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

ValidateConfig() protected method

Validates an OMod config file.
protected ValidateConfig ( byte p_bteData ) : bool
p_bteData byte The OMod config file.
return bool