C# Class Nexus.Client.ModManagement.InstallationLog.InstallLog.TransactionEnlistment

Tracks the changes made to an InstallLog in the scope of a single Transaction. This also provides the means to commit and rollback the tracked changes.
Inheritance: IEnlistmentNotification
Mostrar archivo Open project: NexusMods/NexusModManager-4.5

Public Methods

Method Description
AddActiveMod ( IMod p_modMod, bool p_booIsSpecial ) : string

Adds a mod to the install log, in a transaction.

Adding a mod to the install log assigns it a key. Keys are used to track file and edit versions. If there is no current transaction, the mod is added directly to the install log. Otherwise, the mod is added to a buffer than can later be committed or rolled back.

AddDataFile ( IMod p_modInstallingMod, string p_strDataFilePath ) : void

Logs the specified data file as having been installed by the given mod.

AddGameSpecificValueEdit ( IMod p_modInstallingMod, string p_strKey, byte p_bteValue ) : void

Logs the specified Game Specific Value edit as having been installed by the given mod.

AddIniEdit ( IMod p_modInstallingMod, string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : void

Logs the specified INI edit as having been installed by the given mod.

Commit ( ) : void

Commits the changes to the install log.

Commit ( Enlistment p_eltEnlistment ) : void

Used to notify an enlisted resource manager that the transaction is being committed.

GetCurrentFileOwner ( string p_strPath ) : IMod

Gets the mod that owns the specified file.

GetCurrentGameSpecificValueEditOwner ( string p_strKey ) : IMod

Gets the mod that owns the specified Game Specific Value edit.

GetCurrentIniEditOwner ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : IMod

Gets the mod that owns the specified INI edit.

GetFileInstallers ( string p_strPath ) : IList

Gets all of the mods that have installed the specified file.

The returned list is ordered by install date. In other words, the first mod in the list was the first to install the file, and the last mod in the list was the most recent. This implies that the current version of the specified file was installed by the last mod in the list.

GetGameSpecificValueEditInstallers ( string p_strKey ) : IList

Gets all of the mods that have installed the specified game specific value edit.

GetIniEditInstallers ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : IList

Gets all of the mods that have installed the specified Ini edit.

GetInstalledGameSpecificValueEdits ( IMod p_modInstaller ) : IList

Gets the list of Game Specific Value edited keys that were installed by the given mod.

GetInstalledIniEdits ( IMod p_modInstaller ) : IList

Gets the list of INI edit that were installed by the given mod.

GetInstalledModFiles ( IMod p_modInstaller ) : IList

Gets the list of files that was installed by the given mod.

GetMod ( string p_strKey ) : IMod

Gets the mod identified by the given key.

GetModKey ( IMod p_modMod ) : string

Gets the key that was assigned to the specified mod.

GetPreviousFileOwner ( string p_strPath ) : IMod

Gets the mod that owned the specified file prior to the current owner.

GetPreviousGameSpecificValue ( string p_strKey ) : byte[]

Gets the value of the specified key before it was most recently overwritten.

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

Gets the value of the specified key before it was most recently overwritten.

InDoubt ( Enlistment p_eltEnlistment ) : void

Used to notify an enlisted resource manager that the transaction is in doubt.

A transaction is in doubt if it has not received votes from all enlisted resource managers as to the state of the transaciton.

LogOriginalDataFile ( string p_strDataFilePath ) : void

Logs that the specified data file is an original value.

Logging an original data file prepares it to be overwritten by a mod's file.

LogOriginalGameSpecificValue ( string p_strKey, byte p_bteValue ) : void

Logs that the specified Game Specific Value is an original value.

Logging an original Game Specific Value prepares it to be overwritten by a mod's value.

LogOriginalIniValue ( string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : void

Logs that the specified INI value is an original value.

Logging an original INI value prepares it to be overwritten by a mod's value.

Prepare ( PreparingEnlistment p_entPreparingEnlistment ) : void

Used to notify an enlisted resource manager that the transaction is being prepared for commitment.

RemoveDataFile ( IMod p_modUninstallingMod, string p_strDataFilePath ) : void

Removes the specified data file as having been installed by the given mod.

RemoveGameSpecificValueEdit ( IMod p_modUninstallingMod, string p_strKey ) : void

Removes the specified Game Specific Value edit as having been installed by the given mod.

RemoveIniEdit ( IMod p_modUninstallingMod, string p_strSettingsFileName, string p_strSection, string p_strKey ) : void

Removes the specified ini edit as having been installed by the given mod.

RemoveMod ( IMod p_modUninstaller ) : void

Removes the mod, as well as entries for items installed by the given mod, from the install log.

ReplaceActiveMod ( IMod p_modOldMod, IMod p_modNewMod ) : void

Replaces a mod in the install log, in a transaction.

This replaces a mod in the install log without changing its key.

ReplaceGameSpecificValueEdit ( IMod p_modInstallingMod, string p_strKey, byte p_bteValue ) : void

Replaces the edited value of the specified game specific value edit installed by the given mod.

ReplaceIniEdit ( IMod p_modInstallingMod, string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : void

Replaces the edited value of the specified INI edit installed by the given mod.

Rollback ( Enlistment p_eltEnlistment ) : void

Used to notify an enlisted resource manager that the transaction is being rolled back.

TransactionEnlistment ( Transaction p_txTransaction, InstallLog p_ilgInstallLog ) : System

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

Protected Methods

Method Description
CommitFileChanges ( ) : void

Commits the changes made to installed files.

CommitGameSpecificValueEditChanges ( ) : void

Commits the changes made to game specific value edits.

CommitIniEditChanges ( ) : void

Commits the changes made to Ini file edits.

GetCurrentFileInstallers ( string p_strPath ) : InstallerStack

Gets the ordered list of mod that have installed the specified file.

GetCurrentGameSpecificValueInstallers ( string p_strKey ) : InstallerStack

Gets the ordered list of mod that have installed the specified game specific value edit.

GetCurrentIniEditInstallers ( IniEdit p_iedEdit ) : InstallerStack

Gets the ordered list of mod that have installed the given ini edit.

Private Methods

Method Description
Enlist ( ) : void

Enlists the install log into the current transaction.

Method Details

AddActiveMod() public method

Adds a mod to the install log, in a transaction.
Adding a mod to the install log assigns it a key. Keys are used to track file and edit versions. If there is no current transaction, the mod is added directly to the install log. Otherwise, the mod is added to a buffer than can later be committed or rolled back.
public AddActiveMod ( IMod p_modMod, bool p_booIsSpecial ) : string
p_modMod IMod The being added.
p_booIsSpecial bool Indicates that the mod is a special mod, internal to the /// install log, and show not be included in the list of active mods.
return string

AddDataFile() public method

Logs the specified data file as having been installed by the given mod.
public AddDataFile ( IMod p_modInstallingMod, string p_strDataFilePath ) : void
p_modInstallingMod IMod The mod installing the specified data file.
p_strDataFilePath string The file bieng installed.
return void

AddGameSpecificValueEdit() public method

Logs the specified Game Specific Value edit as having been installed by the given mod.
public AddGameSpecificValueEdit ( IMod p_modInstallingMod, string p_strKey, byte p_bteValue ) : void
p_modInstallingMod IMod The mod installing the specified INI edit.
p_strKey string The key of the edited Game Specific Value.
p_bteValue byte The value installed by the mod.
return void

AddIniEdit() public method

Logs the specified INI edit as having been installed by the given mod.
public AddIniEdit ( IMod p_modInstallingMod, string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : void
p_modInstallingMod IMod The mod installing the specified INI edit.
p_strSettingsFileName string The name of the edited INI file.
p_strSection string The section containing the INI edit.
p_strKey string The key of the edited INI value.
p_strValue string The value installed by the mod.
return void

Commit() public method

Commits the changes to the install log.
public Commit ( ) : void
return void

Commit() public method

Used to notify an enlisted resource manager that the transaction is being committed.
public Commit ( Enlistment p_eltEnlistment ) : void
p_eltEnlistment Nexus.Transactions.Enlistment The enlistment class used to communicate with the resource manager.
return void

CommitFileChanges() protected method

Commits the changes made to installed files.
protected CommitFileChanges ( ) : void
return void

CommitGameSpecificValueEditChanges() protected method

Commits the changes made to game specific value edits.
protected CommitGameSpecificValueEditChanges ( ) : void
return void

CommitIniEditChanges() protected method

Commits the changes made to Ini file edits.
protected CommitIniEditChanges ( ) : void
return void

GetCurrentFileInstallers() protected method

Gets the ordered list of mod that have installed the specified file.
protected GetCurrentFileInstallers ( string p_strPath ) : InstallerStack
p_strPath string The path of the file for which to retrieve the list of installing mods.
return InstallerStack

GetCurrentFileOwner() public method

Gets the mod that owns the specified file.
public GetCurrentFileOwner ( string p_strPath ) : IMod
p_strPath string The path of the file whose owner is to be retrieved.
return IMod

GetCurrentGameSpecificValueEditOwner() public method

Gets the mod that owns the specified Game Specific Value edit.
public GetCurrentGameSpecificValueEditOwner ( string p_strKey ) : IMod
p_strKey string The key of the edited Game Specific Value.
return IMod

GetCurrentGameSpecificValueInstallers() protected method

Gets the ordered list of mod that have installed the specified game specific value edit.
protected GetCurrentGameSpecificValueInstallers ( string p_strKey ) : InstallerStack
p_strKey string The key of the game specific value edit for which to retrieve the list of installing mods.
return InstallerStack

GetCurrentIniEditInstallers() protected method

Gets the ordered list of mod that have installed the given ini edit.
protected GetCurrentIniEditInstallers ( IniEdit p_iedEdit ) : InstallerStack
p_iedEdit IniEdit The ini edit for which to retrieve the list of installing mods.
return InstallerStack

GetCurrentIniEditOwner() public method

Gets the mod that owns the specified INI edit.
public GetCurrentIniEditOwner ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : IMod
p_strSettingsFileName string The name of the edited INI file.
p_strSection string The section containting the INI edit.
p_strKey string The key of the edited INI value.
return IMod

GetFileInstallers() public method

Gets all of the mods that have installed the specified file.
The returned list is ordered by install date. In other words, the first mod in the list was the first to install the file, and the last mod in the list was the most recent. This implies that the current version of the specified file was installed by the last mod in the list.
public GetFileInstallers ( string p_strPath ) : IList
p_strPath string The path of the file whose installers are to be retrieved.
return IList

GetGameSpecificValueEditInstallers() public method

Gets all of the mods that have installed the specified game specific value edit.
public GetGameSpecificValueEditInstallers ( string p_strKey ) : IList
p_strKey string The key whose installers are to be retrieved.
return IList

GetIniEditInstallers() public method

Gets all of the mods that have installed the specified Ini edit.
public GetIniEditInstallers ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : IList
p_strSettingsFileName string The Ini file containing the key whose installers are to be retrieved.
p_strSection string The section containing the key whose installers are to be retrieved.
p_strKey string The key whose installers are to be retrieved.
return IList

GetInstalledGameSpecificValueEdits() public method

Gets the list of Game Specific Value edited keys that were installed by the given mod.
public GetInstalledGameSpecificValueEdits ( IMod p_modInstaller ) : IList
p_modInstaller IMod The mod whose isntalled edits are to be returned.
return IList

GetInstalledIniEdits() public method

Gets the list of INI edit that were installed by the given mod.
public GetInstalledIniEdits ( IMod p_modInstaller ) : IList
p_modInstaller IMod The mod whose isntalled files are to be returned.
return IList

GetInstalledModFiles() public method

Gets the list of files that was installed by the given mod.
public GetInstalledModFiles ( IMod p_modInstaller ) : IList
p_modInstaller IMod The mod whose isntalled files are to be returned.
return IList

GetMod() public method

Gets the mod identified by the given key.
public GetMod ( string p_strKey ) : IMod
p_strKey string The key of the mod to be retrieved.
return IMod

GetModKey() public method

Gets the key that was assigned to the specified mod.
public GetModKey ( IMod p_modMod ) : string
p_modMod IMod The mod whose key is to be retrieved.
return string

GetPreviousFileOwner() public method

Gets the mod that owned the specified file prior to the current owner.
public GetPreviousFileOwner ( string p_strPath ) : IMod
p_strPath string The path of the file whose previous owner is to be retrieved.
return IMod

GetPreviousGameSpecificValue() public method

Gets the value of the specified key before it was most recently overwritten.
public GetPreviousGameSpecificValue ( string p_strKey ) : byte[]
p_strKey string The key of the edited Game Specific Value.
return byte[]

GetPreviousIniValue() public method

Gets the value of the specified key before it was most recently overwritten.
public GetPreviousIniValue ( string p_strSettingsFileName, string p_strSection, string p_strKey ) : string
p_strSettingsFileName string The Ini file containing the key whose previous value is to be retrieved.
p_strSection string The section containing the key whose previous value is to be retrieved.
p_strKey string The key whose previous value is to be retrieved.
return string

InDoubt() public method

Used to notify an enlisted resource manager that the transaction is in doubt.
A transaction is in doubt if it has not received votes from all enlisted resource managers as to the state of the transaciton.
public InDoubt ( Enlistment p_eltEnlistment ) : void
p_eltEnlistment Nexus.Transactions.Enlistment The enlistment class used to communicate with the resource manager.
return void

LogOriginalDataFile() public method

Logs that the specified data file is an original value.
Logging an original data file prepares it to be overwritten by a mod's file.
public LogOriginalDataFile ( string p_strDataFilePath ) : void
p_strDataFilePath string The path of the data file to log as an /// original value.
return void

LogOriginalGameSpecificValue() public method

Logs that the specified Game Specific Value is an original value.
Logging an original Game Specific Value prepares it to be overwritten by a mod's value.
public LogOriginalGameSpecificValue ( string p_strKey, byte p_bteValue ) : void
p_strKey string The key of the edited Game Specific Value.
p_bteValue byte The original value.
return void

LogOriginalIniValue() public method

Logs that the specified INI value is an original value.
Logging an original INI value prepares it to be overwritten by a mod's value.
public LogOriginalIniValue ( string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : void
p_strSettingsFileName string The name of the INI file containing the original value to log.
p_strSection string The section containting the original INI value to log.
p_strKey string The key of the original INI value to log.
p_strValue string The value installed by the mod.
return void

Prepare() public method

Used to notify an enlisted resource manager that the transaction is being prepared for commitment.
public Prepare ( PreparingEnlistment p_entPreparingEnlistment ) : void
p_entPreparingEnlistment Nexus.Transactions.PreparingEnlistment The enlistment class used to communicate with the resource manager.
return void

RemoveDataFile() public method

Removes the specified data file as having been installed by the given mod.
public RemoveDataFile ( IMod p_modUninstallingMod, string p_strDataFilePath ) : void
p_modUninstallingMod IMod The mod for which to remove the specified data file.
p_strDataFilePath string The file being removed for the given mod.
return void

RemoveGameSpecificValueEdit() public method

Removes the specified Game Specific Value edit as having been installed by the given mod.
public RemoveGameSpecificValueEdit ( IMod p_modUninstallingMod, string p_strKey ) : void
p_modUninstallingMod IMod The mod for which to remove the specified Game Specific Value edit.
p_strKey string The key of the Game Specific Value whose edit is being removed for the given mod.
return void

RemoveIniEdit() public method

Removes the specified ini edit as having been installed by the given mod.
public RemoveIniEdit ( IMod p_modUninstallingMod, string p_strSettingsFileName, string p_strSection, string p_strKey ) : void
p_modUninstallingMod IMod The mod for which to remove the specified ini edit.
p_strSettingsFileName string The name of the edited INI file containing the INI edit being removed for the given mod.
p_strSection string The section containting the INI edit being removed for the given mod.
p_strKey string The key of the edited INI value whose edit is being removed for the given mod.
return void

RemoveMod() public method

Removes the mod, as well as entries for items installed by the given mod, from the install log.
public RemoveMod ( IMod p_modUninstaller ) : void
p_modUninstaller IMod The mod to remove.
return void

ReplaceActiveMod() public method

Replaces a mod in the install log, in a transaction.
This replaces a mod in the install log without changing its key.
public ReplaceActiveMod ( IMod p_modOldMod, IMod p_modNewMod ) : void
p_modOldMod IMod The mod with to be replaced with the new mod in the install log.
p_modNewMod IMod The mod with which to replace the old mod in the install log.
return void

ReplaceGameSpecificValueEdit() public method

Replaces the edited value of the specified game specific value edit installed by the given mod.
public ReplaceGameSpecificValueEdit ( IMod p_modInstallingMod, string p_strKey, byte p_bteValue ) : void
p_modInstallingMod IMod The mod whose game specific value edit value is to be replaced.
p_strKey string The key of the game spcified value whose edited value is to be replaced.
p_bteValue byte The value with which to replace the edited value of the specified game specific value edit installed by the given mod.
return void

ReplaceIniEdit() public method

Replaces the edited value of the specified INI edit installed by the given mod.
public ReplaceIniEdit ( IMod p_modInstallingMod, string p_strSettingsFileName, string p_strSection, string p_strKey, string p_strValue ) : void
p_modInstallingMod IMod The mod whose INI edit value is to be replaced.
p_strSettingsFileName string The name of the Ini value whose edited value is to be replaced.
p_strSection string The section of the Ini value whose edited value is to be replaced.
p_strKey string The key of the Ini value whose edited value is to be replaced.
p_strValue string The value with which to replace the edited value of the specified INI edit installed by the given mod.
return void

Rollback() public method

Used to notify an enlisted resource manager that the transaction is being rolled back.
public Rollback ( Enlistment p_eltEnlistment ) : void
p_eltEnlistment Nexus.Transactions.Enlistment The enlistment class used to communicate with the resource manager.
return void

TransactionEnlistment() public method

A simple constructor that initializes the object with the given values.
public TransactionEnlistment ( Transaction p_txTransaction, InstallLog p_ilgInstallLog ) : System
p_txTransaction Nexus.Transactions.Transaction The transaction into which we are enlisting.
p_ilgInstallLog InstallLog The install log whose actions are being transacted.
return System