C# Class Nexus.Client.ModAuthoring.ModBuilder

Builds mods from various sources.
Inheritance: ThreadedBackgroundTask, IDisposable
显示文件 Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Methods

Method Description
BuildFromFile ( IModFormatRegistry p_mfrFormats, string p_strFilePath, ConfirmOverwriteCallback p_dlgConfirmOverwrite ) : void

Builds mods from a file.

This detects the type of file and takes appropriate action.

Dispose ( ) : void

Cancels the task execution.

After being disposed, that is no guarantee that the task's status will be correct. Further interaction with the object is undefined.

ModBuilder ( IGameModeEnvironmentInfo p_gmiGameModeInfo, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility ) : System

A simple construtor that initializes the object with the reqruied dependencies.

Protected Methods

Method Description
DoWork ( object p_objArgs, string &p_strMessage ) : object

The method that is called to start the backgound task.

This method hands off to another methods, as determined by the first parameter which indicates the type of source from which the mod is being built.

Private Methods

Method Description
Compressor_FileCompressionFinished ( object sender, CancelEventArgs e ) : void

Handles the IModCompressor.FileCompressionFinished event of the mod compressors.

This cancels the compression if the user has cancelled the task. This also updates the item progress.

ConfirmOverwrite ( ConfirmOverwriteCallback p_dlgConfirmOverwrite, string p_strDestinationPath ) : string

A wrapper method for calls to ConfirmOverwriteCallback delegates.

This wrapper encapsulates delaing with the different return values the delegate can produce.

DoFromArchive ( IModFormatRegistry p_mfrFormats, string p_strArchivePath, ConfirmOverwriteCallback p_dlgConfirmOverwrite, string &p_strMessage ) : IList

Builds mods from an archive.

If the specified archive contains mods, they are simply extracted. Otherwise, the archive is examined to determine if it is already in a recognized format. If not, or if the archive spans multiple volumes, then the archive is repackaged.

Extractor_FileExtractionFinished ( object sender, SevenZip.FileInfoEventArgs e ) : void

Handles the SevenZipExtractor.FileExtractionFinished event of the archive extractors.

This cancels the extraction if the user has cancelled the task. This also updates the item progress.

Extractor_FileExtractionStarted ( object sender, SevenZip.FileInfoEventArgs e ) : void

Handles the SevenZipExtractor.FileExtractionStarted event of the archive extractors.

This cancels the extraction if the user has cancelled the task.

Method Details

BuildFromFile() public method

Builds mods from a file.
This detects the type of file and takes appropriate action.
Thrown if the specified path is not an archive.
public BuildFromFile ( IModFormatRegistry p_mfrFormats, string p_strFilePath, ConfirmOverwriteCallback p_dlgConfirmOverwrite ) : void
p_mfrFormats IModFormatRegistry The registry of supported mod formats.
p_strFilePath string The archive to build into a mod.
p_dlgConfirmOverwrite ConfirmOverwriteCallback The delegate to call to resolve conflicts with existing files.
return void

Dispose() public method

Cancels the task execution.
After being disposed, that is no guarantee that the task's status will be correct. Further interaction with the object is undefined.
public Dispose ( ) : void
return void

DoWork() protected method

The method that is called to start the backgound task.
This method hands off to another methods, as determined by the first parameter which indicates the type of source from which the mod is being built.
protected DoWork ( object p_objArgs, string &p_strMessage ) : object
p_objArgs object Arguments to for the task execution.
p_strMessage string The message describing the state of the task.
return object

ModBuilder() public method

A simple construtor that initializes the object with the reqruied dependencies.
public ModBuilder ( IGameModeEnvironmentInfo p_gmiGameModeInfo, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility ) : System
p_gmiGameModeInfo IGameModeEnvironmentInfo The environment info of the current game mode.
p_eifEnvironmentInfo IEnvironmentInfo The application's envrionment info.
p_futFileUtility Nexus.Client.Util.FileUtil The file utility class.
return System