Nexus.Client.ModManagement.ModInstaller.RunScript C# (CSharp) Method

RunScript() protected method

This executes the install script.
protected RunScript ( TxFileManager p_tfmFileManager ) : bool
p_tfmFileManager ChinhDo.Transactions.TxFileManager The transactional file manager to use to interact with the file system.
return bool
		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)
			{
				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, 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);
			mfiFileInstaller.FinalizeInstall();
			return booResult;
		}