C# Class Nexus.Client.ApplicationInitializer

The task that initializes the application.
Inheritance: ThreadedBackgroundTask
Afficher le fichier Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Méthodes publiques

Méthode Description
ApplicationInitializer ( EnvironmentInfo p_eifEnvironmentInfo, NexusFontSetResolver p_nfrFontSetResolver ) : System

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

Initialize ( IGameModeFactory p_gmfGameModeFactory, SynchronizationContext p_scxUIContext ) : void

Initializes the application.

Méthodes protégées

Méthode Description
ApplyDelayedSetting ( string p_strKey, string p_strValue, ViewMessage &p_vwmErrorMessage ) : bool

Applies the specified setting that was deferred to the next application startup.

ApplyDelayedSettings ( string p_strGameModeId, ViewMessage &p_vwmErrorMessage ) : bool

Applies any settings that were deferred to the next application startup.

CreateEnvironmentPaths ( IGameMode p_gmdGameMode, ViewMessage &p_vwmErrorMessage ) : bool

Ensures that the game mode environment's paths exist.

DisposeServices ( ServiceManager p_smgServices ) : void

This disposes of the services we created.

DoApplicationInitialize ( IGameModeFactory p_gmfGameModeFactory, SynchronizationContext p_scxUIContext, ViewMessage &p_vwmErrorMessage ) : bool

Performs the applicatio initialization.

DoWork ( object p_objArgs ) : object

The method that is called to start the backgound task.

InitializeServices ( IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, NexusFileUtil p_nfuFileUtility, SynchronizationContext p_scxUIContext, ViewMessage &p_vwmErrorMessage ) : ServiceManager

This initializes the services required to run the client.

Login ( IGameMode p_gmdGameMode, IModRepository p_mrpModRepository ) : bool

Logins the user into the current mod repository.

OnTaskStarted ( EventArgs e ) : void

Raises the TaskStarted event.

OnTaskStarted ( IBackgroundTask p_bgtTask ) : void

Raises the TaskStarted event.

ScanForReadonlyFiles ( IGameMode p_gmdGameMode ) : void

This chaecks for any files that are readonly.

UacCheck ( string p_strPath ) : bool

Checks to see if UAC is interfering with file installation.

UacCheckEnvironment ( IGameMode p_gmdGameMode, ViewMessage &p_vwmErrorMessage ) : bool

Checks to see if UAC is interfering with file installation.

UninstallMissingMods ( IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, ModManager p_mmgModManager ) : bool

Uninstalls mods that have been manually removed since the last time the mod manager ran.

UpgradeMismatchedVersionMods ( IInstallLog p_ilgInstallLog, ModManager p_mmgModManager ) : void

Upgrade mods that have been manually replaced since the last time the mod manager ran.

WaitForSet ( IBackgroundTaskSet p_btsTaskSet, bool p_booHookTaskStarted ) : void

Waits for the task set to complete, and notifies listeners of any task started by the set.

Private Methods

Méthode Description
ConfirmMismatchedVersionModUpgrade ( IMod p_modOld, IMod p_modNew ) : bool

Asks the user if the given mod whose version does not its version in the install log should be upgraded.

If the user opts to not upgrade the mod, the verison is changed in the install log, but no other action is taken.

TaskSet_TaskSetCompleted ( object sender, TaskSetCompletedEventArgs e ) : void

Handles the IBackgroundTaskSet.TaskSetCompleted event of a task set.

This signals the wait handle that is blocking the initialization thread, allowing it to continue with the initialization.

TaskSet_TaskStarted ( object sender, EventArgs e ) : void

Handles the IBackgroundTaskSet.TaskStarted event of a task set.

This lets listeners know a task has started.

Task_TaskEnded ( object sender, TaskEndedEventArgs e ) : void

Handles the IBackgroundTask.TaskEnded event of tasks run during initialization.

This signals the wait handle that is blocking the initialization thread, allowing it to continue with the initialization.

Method Details

ApplicationInitializer() public méthode

A simple constructor that initializes the object with the given values.
public ApplicationInitializer ( EnvironmentInfo p_eifEnvironmentInfo, NexusFontSetResolver p_nfrFontSetResolver ) : System
p_eifEnvironmentInfo EnvironmentInfo The application's envrionment info.
p_nfrFontSetResolver Nexus.Client.UI.NexusFontSetResolver The to use.
Résultat System

ApplyDelayedSetting() protected méthode

Applies the specified setting that was deferred to the next application startup.
protected ApplyDelayedSetting ( string p_strKey, string p_strValue, ViewMessage &p_vwmErrorMessage ) : bool
p_strKey string The key of the setting to apply.
p_strValue string The value of the setting to apply.
p_vwmErrorMessage Nexus.Client.UI.ViewMessage The error message if the application of the setting fails.
Résultat bool

ApplyDelayedSettings() protected méthode

Applies any settings that were deferred to the next application startup.
protected ApplyDelayedSettings ( string p_strGameModeId, ViewMessage &p_vwmErrorMessage ) : bool
p_strGameModeId string The id of the current game mode.
p_vwmErrorMessage Nexus.Client.UI.ViewMessage The error message if the application of settings fails.
Résultat bool

CreateEnvironmentPaths() protected méthode

Ensures that the game mode environment's paths exist.
protected CreateEnvironmentPaths ( IGameMode p_gmdGameMode, ViewMessage &p_vwmErrorMessage ) : bool
p_gmdGameMode IGameMode The game mode whose paths are to be created.
p_vwmErrorMessage Nexus.Client.UI.ViewMessage The error message if the creation fails.
Résultat bool

DisposeServices() protected méthode

This disposes of the services we created.
protected DisposeServices ( ServiceManager p_smgServices ) : void
p_smgServices ServiceManager The services to dispose.
Résultat void

DoApplicationInitialize() protected méthode

Performs the applicatio initialization.
protected DoApplicationInitialize ( IGameModeFactory p_gmfGameModeFactory, SynchronizationContext p_scxUIContext, ViewMessage &p_vwmErrorMessage ) : bool
p_gmfGameModeFactory IGameModeFactory The factory to use to create the game mode for which we will be managing mods.
p_scxUIContext System.Threading.SynchronizationContext The to use to marshall UI interactions to the UI thread.
p_vwmErrorMessage Nexus.Client.UI.ViewMessage The error message if the initialization failed.
Résultat bool

DoWork() protected méthode

The method that is called to start the backgound task.
protected DoWork ( object p_objArgs ) : object
p_objArgs object Arguments to for the task execution.
Résultat object

Initialize() public méthode

Initializes the application.
public Initialize ( IGameModeFactory p_gmfGameModeFactory, SynchronizationContext p_scxUIContext ) : void
p_gmfGameModeFactory IGameModeFactory The factory to use to create the game mode for which we will be managing mods.
p_scxUIContext System.Threading.SynchronizationContext The to use to marshall UI interactions to the UI thread.
Résultat void

InitializeServices() protected méthode

This initializes the services required to run the client.
protected InitializeServices ( IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, NexusFileUtil p_nfuFileUtility, SynchronizationContext p_scxUIContext, ViewMessage &p_vwmErrorMessage ) : ServiceManager
p_gmdGameMode IGameMode The game mode for which mods are being managed.
p_mrpModRepository IModRepository The mod repository to use to retrieve mods and mod metadata.
p_nfuFileUtility Nexus.Client.Util.NexusFileUtil The file utility class.
p_scxUIContext System.Threading.SynchronizationContext The to use to marshall UI interactions to the UI thread.
p_vwmErrorMessage Nexus.Client.UI.ViewMessage The error message if the UAC check failed.
Résultat ServiceManager

Login() protected méthode

Logins the user into the current mod repository.
protected Login ( IGameMode p_gmdGameMode, IModRepository p_mrpModRepository ) : bool
p_gmdGameMode IGameMode The current game mode.
p_mrpModRepository IModRepository The mod repository to use to retrieve mods and mod metadata.
Résultat bool

OnTaskStarted() protected méthode

Raises the TaskStarted event.
protected OnTaskStarted ( EventArgs e ) : void
e EventArgs An describing the task that was started.
Résultat void

OnTaskStarted() protected méthode

Raises the TaskStarted event.
protected OnTaskStarted ( IBackgroundTask p_bgtTask ) : void
p_bgtTask IBackgroundTask The task that was started.
Résultat void

ScanForReadonlyFiles() protected méthode

This chaecks for any files that are readonly.
protected ScanForReadonlyFiles ( IGameMode p_gmdGameMode ) : void
p_gmdGameMode IGameMode
Résultat void

UacCheck() protected méthode

Checks to see if UAC is interfering with file installation.
protected UacCheck ( string p_strPath ) : bool
p_strPath string The path for which we are to check if UAC is intefeing.
Résultat bool

UacCheckEnvironment() protected méthode

Checks to see if UAC is interfering with file installation.
protected UacCheckEnvironment ( IGameMode p_gmdGameMode, ViewMessage &p_vwmErrorMessage ) : bool
p_gmdGameMode IGameMode The game mode whose paths are to be checked.
p_vwmErrorMessage Nexus.Client.UI.ViewMessage The error message if the initialization failed.
Résultat bool

UninstallMissingMods() protected méthode

Uninstalls mods that have been manually removed since the last time the mod manager ran.
protected UninstallMissingMods ( IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, ModManager p_mmgModManager ) : bool
p_gmdGameMode IGameMode The game mode currently being managed.
p_eifEnvironmentInfo IEnvironmentInfo The application's envrionment info.
p_mmgModManager Nexus.Client.ModManagement.ModManager The mod manager to use to uninstall any missing mods.
Résultat bool

UpgradeMismatchedVersionMods() protected méthode

Upgrade mods that have been manually replaced since the last time the mod manager ran.
protected UpgradeMismatchedVersionMods ( IInstallLog p_ilgInstallLog, ModManager p_mmgModManager ) : void
p_ilgInstallLog IInstallLog The install log to use to log file installations.
p_mmgModManager Nexus.Client.ModManagement.ModManager The mod manager to use to upgrade any replaced mods.
Résultat void

WaitForSet() protected méthode

Waits for the task set to complete, and notifies listeners of any task started by the set.
protected WaitForSet ( IBackgroundTaskSet p_btsTaskSet, bool p_booHookTaskStarted ) : void
p_btsTaskSet IBackgroundTaskSet The task set for which to wait.
p_booHookTaskStarted bool Whether or not to attach a listener to the event.
Résultat void