/// <summary> /// Runs the basic install script. /// </summary> /// <remarks> /// A basic install installs all of the files in the mod to the installation directory, /// and activates all plugin files. /// </remarks> /// <param name="p_mfiFileInstaller">The file installer to use.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <param name="p_dicInstallFiles">The list of specific files to install, if null the mod will be installed as usual.</param> /// <returns><c>true</c> if the installation was successful; /// <c>false</c> otherwise.</returns> protected bool RunBasicInstallScript(IModFileInstaller p_mfiFileInstaller, ReadOnlyObservableList <IMod> p_rolActiveMods, List <KeyValuePair <string, string> > p_dicInstallFiles) { BasicInstallTask bitTask = new BasicInstallTask(Mod, GameMode, p_mfiFileInstaller, PluginManager, VirtualModActivator, EnvironmentInfo.Settings.SkipReadmeFiles, p_rolActiveMods, p_dicInstallFiles); OnTaskStarted(bitTask); return(bitTask.Execute()); }
/// <summary> /// This executes the install script. /// </summary> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns><c>true</c> if the script completed successfully; /// <c>false</c> otherwise.</returns> protected bool RunScript(TxFileManager p_tfmFileManager) { IModFileInstaller mfiFileInstaller = CreateFileInstaller(p_tfmFileManager, m_dlgOverwriteConfirmationDelegate); bool booResult = false; if (Mod.HasInstallScript) { IDataFileUtil dfuDataFileUtility = new DataFileUtil(GameMode.GameModeEnvironmentInfo.InstallationPath); IIniInstaller iniIniInstaller = CreateIniInstaller(p_tfmFileManager, m_dlgOverwriteConfirmationDelegate); IGameSpecificValueInstaller gviGameSpecificValueInstaller = CreateGameSpecificValueInstaller(p_tfmFileManager, m_dlgOverwriteConfirmationDelegate); InstallerGroup ipgInstallers = new InstallerGroup(dfuDataFileUtility, mfiFileInstaller, iniIniInstaller, gviGameSpecificValueInstaller, PluginManager); IScriptExecutor sexScript = Mod.InstallScript.Type.CreateExecutor(Mod, GameMode, EnvironmentInfo, ipgInstallers, UIContext); sexScript.TaskStarted += new EventHandler <EventArgs <IBackgroundTask> >(ScriptExecutor_TaskStarted); sexScript.TaskSetCompleted += new EventHandler <TaskSetCompletedEventArgs>(ScriptExecutor_TaskSetCompleted); booResult = sexScript.Execute(Mod.InstallScript); iniIniInstaller.FinalizeInstall(); if (gviGameSpecificValueInstaller != null) { gviGameSpecificValueInstaller.FinalizeInstall(); } } else { booResult = RunBasicInstallScript(mfiFileInstaller, ActiveMods); } mfiFileInstaller.FinalizeInstall(); return(booResult); }
/// <summary> /// A sinmple constructor that initializes the object with the given values. /// </summary> /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param> /// <param name="p_mfiFileInstaller">The installer to use to install files.</param> /// <param name="p_iniIniInstaller">The installer to use to install INI values.</param> /// <param name="p_gviGameSpecificValueInstaller">The installer to use to install game specific values.</param> /// <param name="p_pmgPluginManager">The manager to use to manage plugins.</param> public InstallerGroup(IDataFileUtil p_dfuDataFileUtility, IModFileInstaller p_mfiFileInstaller, IIniInstaller p_iniIniInstaller, IGameSpecificValueInstaller p_gviGameSpecificValueInstaller, IPluginManager p_pmgPluginManager) { DataFileUtility = p_dfuDataFileUtility; FileInstaller = p_mfiFileInstaller; IniInstaller = p_iniIniInstaller; GameSpecificValueInstaller = p_gviGameSpecificValueInstaller; PluginManager = p_pmgPluginManager; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The the current game mode.</param> /// <param name="p_mfiFileInstaller">The file installer to use.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_booSkipReadme">Whether to skip the installation of readme files.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public BasicInstallTask(IMod p_modMod, IGameMode p_gmdGameMode, IModFileInstaller p_mfiFileInstaller, IPluginManager p_pmgPluginManager, bool p_booSkipReadme, ReadOnlyObservableList<IMod> p_rolActiveMods) { Mod = p_modMod; GameMode = p_gmdGameMode; FileInstaller = p_mfiFileInstaller; PluginManager = p_pmgPluginManager; SkipReadme = p_booSkipReadme; ActiveMods = p_rolActiveMods; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The the current game mode.</param> /// <param name="p_mfiFileInstaller">The file installer to use.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_booSkipReadme">Whether to skip the installation of readme files.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public BasicInstallTask(IMod p_modMod, IGameMode p_gmdGameMode, IModFileInstaller p_mfiFileInstaller, IPluginManager p_pmgPluginManager, bool p_booSkipReadme, ReadOnlyObservableList <IMod> p_rolActiveMods) { Mod = p_modMod; GameMode = p_gmdGameMode; FileInstaller = p_mfiFileInstaller; PluginManager = p_pmgPluginManager; SkipReadme = p_booSkipReadme; ActiveMods = p_rolActiveMods; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_gmdGameMode">The the current game mode.</param> /// <param name="p_mfiFileInstaller">The file installer to use.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_booSkipReadme">Whether to skip the installation of readme files.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <param name="p_lstInstallFiles">The list of specific files to install, if null the mod will be installed as usual.</param> public BasicInstallTask(IMod p_modMod, IGameMode p_gmdGameMode, IModFileInstaller p_mfiFileInstaller, IPluginManager p_pmgPluginManager, IVirtualModActivator p_ivaVirtualModActivator, bool p_booSkipReadme, ReadOnlyObservableList <IMod> p_rolActiveMods, List <KeyValuePair <string, string> > p_dicInstallFiles) { Mod = p_modMod; GameMode = p_gmdGameMode; FileInstaller = p_mfiFileInstaller; PluginManager = p_pmgPluginManager; VirtualModActivator = p_ivaVirtualModActivator; SkipReadme = p_booSkipReadme; ActiveMods = p_rolActiveMods; FilesToInstall = p_dicInstallFiles; }
/// <summary> /// This executes the install script. /// </summary> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns><c>true</c> if the script completed successfully; /// <c>false</c> otherwise.</returns> protected bool RunScript(TxFileManager p_tfmFileManager) { IModFileInstaller mfiFileInstaller = CreateFileInstaller(p_tfmFileManager, m_dlgOverwriteConfirmationDelegate); bool booResult = false; IIniInstaller iniIniInstaller = null; IGameSpecificValueInstaller gviGameSpecificValueInstaller = null; if (Mod.HasInstallScript) { if (CheckScriptedModLog()) { booResult = RunBasicInstallScript(mfiFileInstaller, ActiveMods, LoadXMLModFilesToInstall()); } else { try { IDataFileUtil dfuDataFileUtility = new DataFileUtil(GameMode.GameModeEnvironmentInfo.InstallationPath); iniIniInstaller = CreateIniInstaller(p_tfmFileManager, m_dlgOverwriteConfirmationDelegate); gviGameSpecificValueInstaller = CreateGameSpecificValueInstaller(p_tfmFileManager, m_dlgOverwriteConfirmationDelegate); InstallerGroup ipgInstallers = new InstallerGroup(dfuDataFileUtility, mfiFileInstaller, iniIniInstaller, gviGameSpecificValueInstaller, PluginManager); IScriptExecutor sexScript = Mod.InstallScript.Type.CreateExecutor(Mod, GameMode, EnvironmentInfo, VirtualModActivator, ipgInstallers, UIContext); sexScript.TaskStarted += new EventHandler <EventArgs <IBackgroundTask> >(ScriptExecutor_TaskStarted); sexScript.TaskSetCompleted += new EventHandler <TaskSetCompletedEventArgs>(ScriptExecutor_TaskSetCompleted); booResult = sexScript.Execute(Mod.InstallScript); } catch (Exception ex) { PopupErrorMessage = ex.Message; PopupErrorMessageType = "Error"; } iniIniInstaller.FinalizeInstall(); if (gviGameSpecificValueInstaller != null) { gviGameSpecificValueInstaller.FinalizeInstall(); } } } else { booResult = RunBasicInstallScript(mfiFileInstaller, ActiveMods, null); } mfiFileInstaller.FinalizeInstall(); return(booResult); }
/// <summary> /// Runs the basic install script. /// </summary> /// <remarks> /// A basic install installs all of the files in the mod to the installation directory, /// and activates all plugin files. /// </remarks> /// <param name="p_mfiFileInstaller">The file installer to use.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <returns><c>true</c> if the installation was successful; /// <c>false</c> otherwise.</returns> protected bool RunBasicInstallScript(IModFileInstaller p_mfiFileInstaller, ReadOnlyObservableList<IMod> p_rolActiveMods) { BasicInstallTask bitTask = new BasicInstallTask(Mod, GameMode, p_mfiFileInstaller, PluginManager, EnvironmentInfo.Settings.SkipReadmeFiles, p_rolActiveMods); OnTaskStarted(bitTask); return bitTask.Execute(); }