/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_UsesPlugins">Game using plugin or mods (True for plugins).</param> public ModFileUpgradeInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins) : base(p_gmiGameModeInfo, p_modMod, p_ilgInstallLog, p_pmgPluginManager, p_dfuDataFileUtility, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate, p_UsesPlugins, null) { OriginallyInstalledFiles = new Set<string>(StringComparer.OrdinalIgnoreCase); foreach (string strFile in InstallLog.GetInstalledModFiles(Mod)) OriginallyInstalledFiles.Add(strFile.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public IniInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { TouchedFiles = new Set<string>(StringComparer.OrdinalIgnoreCase); Mod = p_modMod; InstallLog = p_ilgInstallLog; TransactionalFileManager = p_tfmFileManager; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_UsesPlugins">Whether the file is a mod or a plugin.</param> public ModFileInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins) { GameModeInfo = p_gmiGameModeInfo; Mod = p_modMod; InstallLog = p_ilgInstallLog; PluginManager = p_pmgPluginManager; DataFileUtility = p_dfuDataFileUtility; TransactionalFileManager = p_tfmFileManager; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No); IsPlugin = p_UsesPlugins; }
/// <summary> /// Activates the given mod. /// </summary> /// <remarks> /// The given mod is either installed or upgraded, as appropriate. /// </remarks> /// <param name="p_modMod">The mod to install.</param> /// <param name="p_dlgUpgradeConfirmationDelegate">The delegate that is called to confirm whether an upgrade install should be performed.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet Activate(IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList<IMod> p_rolActiveMods) { ModMatcher mmcMatcher = new ModMatcher(InstallationLog.ActiveMods, true); IMod modOldVersion = mmcMatcher.FindAlternateVersion(p_modMod, true); ConfirmUpgradeResult curAction = (modOldVersion == null) ? ConfirmUpgradeResult.NormalActivation : p_dlgUpgradeConfirmationDelegate(modOldVersion, p_modMod); switch (curAction) { case ConfirmUpgradeResult.Upgrade: ModInstaller muiUpgrader = InstallerFactory.CreateUpgradeInstaller(modOldVersion, p_modMod, p_dlgOverwriteConfirmationDelegate); return muiUpgrader; case ConfirmUpgradeResult.NormalActivation: ModInstaller minInstaller = InstallerFactory.CreateInstaller(p_modMod, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods); return minInstaller; case ConfirmUpgradeResult.Cancel: return null; default: throw new Exception(String.Format("Unrecognized value for ConfirmUpgradeResult: {0}", curAction)); } }
/// <summary> /// Forces an upgrade from one mod to another. /// </summary> /// <remarks> /// No checks as to whether the two mods are actually related are performed. The new mod is reactivated /// as if it were the old mod, and the old mod is replaced by the new mod. /// </remarks> /// <param name="p_modOldMod">The mod from which to upgrade.</param> /// <param name="p_modNewMod">The mod to which to upgrade.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ForceUpgrade(IMod p_modOldMod, IMod p_modNewMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return Activator.ForceUpgrade(p_modOldMod, p_modNewMod, p_dlgOverwriteConfirmationDelegate); }
/// <summary> /// Creates a mod upgrader for the given mod. /// </summary> /// <param name="p_modOldMod">The mod from which to upgrade.</param> /// <param name="p_modNewMod">The mod to which to upgrade.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>A mod upgrader for the given mod.</returns> public ModInstaller CreateUpgradeInstaller(IMod p_modOldMod, IMod p_modNewMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return new ModUpgrader(p_modOldMod, p_modNewMod, m_gmdGameMode, m_eifEnvironmentInfo, m_futFileUtility, m_scxUIContext, m_ilgInstallLog, m_pmgPluginManager, p_dlgOverwriteConfirmationDelegate); }
/// <summary> /// Reinstalls the given mod. /// </summary> /// <param name="p_modMod">The mod to reinstall.</param> /// <param name="p_dlgUpgradeConfirmationDelegate">The delegate that is called to confirm whether an upgrade install should be performed.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list or Active mods.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ReinstallMod(IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList <IMod> p_rolActiveMods) { DeleteXMLInstalledFile(p_modMod); return(Activator.Activate(p_modMod, p_dlgUpgradeConfirmationDelegate, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods, true)); }
/// <summary> /// Gets the installer to use to upgrade game specific values. /// </summary> /// <param name="p_modMod">The mod being upgraded.</param> /// <param name="p_ilgInstallLog">The install log to use to log the installation of the game specific values.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns>The installer to use to manage game specific values, or <c>null</c> if the game mode does not /// install any game specific values.</returns> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public abstract IGameSpecificValueInstaller GetGameSpecificValueUpgradeInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate);
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public IniUpgradeInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) : base(p_modMod, p_ilgInstallLog, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate) { OriginallyInstalledEdits = new Set<IniEdit>(); OriginallyInstalledEdits.AddRange(InstallLog.GetInstalledIniEdits(Mod)); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_UsesPlugins">Whether the file is a mod or a plugin.</param> public ModFileInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins, ModManager p_mmModManager) { GameModeInfo = p_gmiGameModeInfo; Mod = p_modMod; InstallLog = p_ilgInstallLog; PluginManager = p_pmgPluginManager; DataFileUtility = p_dfuDataFileUtility; TransactionalFileManager = p_tfmFileManager; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No); IsPlugin = p_UsesPlugins; m_mmModManager = p_mmModManager; }
/// <summary> /// Forces an upgrade from one mod to another. /// </summary> /// <remarks> /// No checks as to whether the two mods are actually related are performed. The new mod is reactivated /// as if it were the old mod, and the old mod is replaced by the new mod. /// </remarks> /// <param name="p_modOldMod">The mod from which to upgrade.</param> /// <param name="p_modNewMod">The mod to which to upgrade.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <exception cref="InvalidOperationException">Thrown if <paramref name="p_modNewMod"/> is already active.</exception> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ForceUpgrade(IMod p_modOldMod, IMod p_modNewMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { if (InstallationLog.ActiveMods.Contains(p_modNewMod)) throw new InvalidOperationException(String.Format("Cannot upgrade to a mod that is already active. (Trying to upgrade {0} {1} to {2} {3})", p_modOldMod.ModName, p_modOldMod.HumanReadableVersion, p_modNewMod.ModName, p_modNewMod.HumanReadableVersion)); ModInstaller muiUpgrader = InstallerFactory.CreateUpgradeInstaller(p_modOldMod, p_modNewMod, p_dlgOverwriteConfirmationDelegate); muiUpgrader.Install(); return muiUpgrader; }
/// <summary> /// Reactivates the given mod. /// </summary> /// <remarks> /// A reactivation is an upgrade of a mod to itself. It re-runs the activation, /// without changing the installed precedence of its files and installed values. /// </remarks> /// <param name="p_modMod">The mod to reactivate.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet Reactivate(IMod p_modMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { ModInstaller muiUpgrader = InstallerFactory.CreateUpgradeInstaller(p_modMod, p_modMod, p_dlgOverwriteConfirmationDelegate); muiUpgrader.Install(); return muiUpgrader; }
/// <summary> /// Activates the given mod. /// </summary> /// <remarks> /// The given mod is either installed or upgraded, as appropriate. /// </remarks> /// <param name="p_modMod">The mod to install.</param> /// <param name="p_dlgUpgradeConfirmationDelegate">The delegate that is called to confirm whether an upgrade install should be performed.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet Activate(IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList <IMod> p_rolActiveMods, bool p_booOverrideUpgrade) { ModMatcher mmcMatcher = new ModMatcher(InstallationLog.ActiveMods, true); IMod modOldVersion = mmcMatcher.FindAlternateVersion(p_modMod, true); ConfirmUpgradeResult curAction = ConfirmUpgradeResult.NormalActivation; if (!p_booOverrideUpgrade) { curAction = (modOldVersion == null) ? ConfirmUpgradeResult.NormalActivation : p_dlgUpgradeConfirmationDelegate(modOldVersion, p_modMod); } switch (curAction) { case ConfirmUpgradeResult.Upgrade: ModInstaller muiUpgrader = InstallerFactory.CreateUpgradeInstaller(modOldVersion, p_modMod, p_dlgOverwriteConfirmationDelegate); return(muiUpgrader); case ConfirmUpgradeResult.NormalActivation: ModInstaller minInstaller = InstallerFactory.CreateInstaller(p_modMod, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods); return(minInstaller); case ConfirmUpgradeResult.Cancel: return(null); default: throw new Exception(String.Format("Unrecognized value for ConfirmUpgradeResult: {0}", curAction)); } }
/// <summary> /// Gets the installer to use to upgrade game specific values. /// </summary> /// <param name="p_modMod">The mod being upgraded.</param> /// <param name="p_ilgInstallLog">The install log to use to log the installation of the game specific values.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns>The installer to use to manage game specific values, or <c>null</c> if the game mode does not /// install any game specific values.</returns> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public override IGameSpecificValueInstaller GetGameSpecificValueUpgradeInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(new GamebryoGameSpecificValueInstaller(p_modMod, GameModeEnvironmentInfo, p_ilgInstallLog, p_tfmFileManager, p_futFileUtility, p_dlgOverwriteConfirmationDelegate)); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_mmgModManager">The mod manager to use to upgrade any replaced mods.</param> /// <param name="p_dlgConfirmUpgrade">The delegate to call to confirm that a mismatched version mod should be upgraded.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public UpgradeMismatchedVersionScanner(IInstallLog p_ilgInstallLog, ModManager p_mmgModManager, ConfirmMismatchedVersionModUpgradeDelegate p_dlgConfirmUpgrade, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { InstallLog = p_ilgInstallLog; ModManager = p_mmgModManager; m_dlgConfirmUpgrade = p_dlgConfirmUpgrade; m_dlgOverwriteConfirmation = p_dlgOverwriteConfirmationDelegate; }
/// <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 current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info /// for the current game mode</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public ModInstaller(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgModInstallLog, IPluginManager p_pmgPluginManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList<IMod> p_rolActiveMods, ModManager p_mmModManager) { Mod = p_modMod; GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; FileUtility = p_futFileUtility; UIContext = p_scxUIContext; ModInstallLog = p_ilgModInstallLog; PluginManager = p_pmgPluginManager; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate; ActiveMods = p_rolActiveMods; m_mmModManager = p_mmModManager; }
/// <summary> /// Creates the file installer to use to install the mod's ini edits. /// </summary> /// <remarks> /// This returns the regular <see cref="IniInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected virtual IIniInstaller CreateIniInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return new IniInstaller(Mod, ModInstallLog, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> public ActivateMultipleModsTask(List <IMod> p_lstModList, bool p_booAllowCancel, IInstallLog p_iilInstallLog, ModInstallerFactory p_mifModInstallerFactory, ConfirmActionMethod p_camConfirm, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { m_iilInstallLog = p_iilInstallLog; m_mifModInstallerFactory = p_mifModInstallerFactory; m_lstModList = p_lstModList; m_camConfirm = p_camConfirm; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate; }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public GamebryoGameSpecificValueUpgradeInstaller(IMod p_modMod, IGameModeEnvironmentInfo p_gmiGameModeInfo, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) :base(p_modMod, p_gmiGameModeInfo, p_ilgInstallLog, p_tfmFileManager, p_futFileUtility, p_dlgOverwriteConfirmationDelegate) { OriginallyInstalledEdits = new Set<string>(); OriginallyInstalledEdits.AddRange(InstallLog.GetInstalledGameSpecificValueEdits(Mod)); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_UsesPlugins">Game using plugin or mods (True for plugins).</param> /// <param name="p_eifEnvironmentInfo">Environment info for the entire program.</param> public ModFileUpgradeInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins, IEnvironmentInfo p_eifEnvironmentInfo) : base(p_gmiGameModeInfo, p_modMod, p_ilgInstallLog, p_pmgPluginManager, p_dfuDataFileUtility, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate, p_UsesPlugins, p_eifEnvironmentInfo) { OriginallyInstalledFiles = new Set <string>(StringComparer.OrdinalIgnoreCase); foreach (string strFile in InstallLog.GetInstalledModFiles(Mod)) { OriginallyInstalledFiles.Add(strFile.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)); } }
/// <summary> /// Gets the installer to use to install game specific values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log the installation of the game specific values.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns>The installer to use to manage game specific values, or <c>null</c> if the game mode does not /// install any game specific values.</returns> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public abstract IGameSpecificValueInstaller GetGameSpecificValueInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate);
/// <summary> /// Gets the installer to use to upgrade game specific values. /// </summary> /// <param name="p_modMod">The mod being upgraded.</param> /// <param name="p_ilgInstallLog">The install log to use to log the installation of the game specific values.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns>The installer to use to manage game specific values, or <c>null</c> if the game mode does not /// install any game specific values.</returns> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public override IGameSpecificValueInstaller GetGameSpecificValueUpgradeInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(null); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_mmgModManager">The mod manager to use to upgrade any replaced mods.</param> /// <param name="p_dlgConfirmUpgrade">The delegate to call to confirm that a mismatched version mod should be upgraded.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public UpgradeMismatchedVersionScanner(IInstallLog p_ilgInstallLog, ModManager p_mmgModManager, ConfirmMismatchedVersionModUpgradeDelegate p_dlgConfirmUpgrade, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { InstallLog = p_ilgInstallLog; ModManager = p_mmgModManager; m_dlgConfirmUpgrade = p_dlgConfirmUpgrade; m_dlgOverwriteConfirmation = p_dlgOverwriteConfirmationDelegate; }
/// <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 current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info /// for the current game mode</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> public ModInstaller(IMod p_modMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgModInstallLog, IPluginManager p_pmgPluginManager, IVirtualModActivator p_ivaVirtualModActivator, IProfileManager p_prmProfileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList <IMod> p_rolActiveMods) { Mod = p_modMod; GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; FileUtility = p_futFileUtility; UIContext = p_scxUIContext; ModInstallLog = p_ilgModInstallLog; PluginManager = p_pmgPluginManager; VirtualModActivator = p_ivaVirtualModActivator; ProfileManager = p_prmProfileManager; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate; ActiveMods = p_rolActiveMods; }
/// <summary> /// Creates a mod installer for the given mod. /// </summary> /// <param name="p_modMod">The mod for which to create the installer.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list of active mods.</param> /// <returns>A mod installer for the given mod.</returns> public ModInstaller CreateInstaller(IMod p_modMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList<IMod> p_rolActiveMods) { return new ModInstaller(p_modMod, m_gmdGameMode, m_eifEnvironmentInfo, m_futFileUtility, m_scxUIContext, m_ilgInstallLog, m_pmgPluginManager, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods, m_mmModManager); }
/// <summary> /// Creates the file installer to use to install the mod's ini edits. /// </summary> /// <remarks> /// This returns the regular <see cref="IniInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected virtual IIniInstaller CreateIniInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(new IniInstaller(Mod, ModInstallLog, VirtualModActivator, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate)); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modOldMod">The mod from which to upgrade.</param> /// <param name="p_modNewMod">The mod to which to upgrade.</param> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info /// for the current game mode</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public ModUpgrader(IMod p_modOldMod, IMod p_modNewMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgModInstallLog, IPluginManager p_pmgPluginManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) : base(p_modNewMod, p_gmdGameMode, p_eifEnvironmentInfo, p_futFileUtility, p_scxUIContext, p_ilgModInstallLog, p_pmgPluginManager, p_dlgOverwriteConfirmationDelegate, null, null) { OldMod = p_modOldMod; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_modOldMod">The mod from which to upgrade.</param> /// <param name="p_modNewMod">The mod to which to upgrade.</param> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info /// for the current game mode</param> /// <param name="p_pmgPluginManager">The plugin manager.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public ModUpgrader(IMod p_modOldMod, IMod p_modNewMod, IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgModInstallLog, IPluginManager p_pmgPluginManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) : base(p_modNewMod, p_gmdGameMode, p_eifEnvironmentInfo, p_futFileUtility, p_scxUIContext, p_ilgModInstallLog, p_pmgPluginManager, p_dlgOverwriteConfirmationDelegate, null, null) { OldMod = p_modOldMod; }
/// <summary> /// Activates the given mod. /// </summary> /// <param name="p_modMod">The mod to activate.</param> /// <param name="p_dlgUpgradeConfirmationDelegate">The delegate that is called to confirm whether an upgrade install should be performed.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list or Active mods.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ActivateMod(IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList<IMod> p_rolActiveMods) { if (InstallationLog.ActiveMods.Contains(p_modMod)) return null; DeleteXMLInstalledFile(p_modMod); return Activator.Activate(p_modMod, p_dlgUpgradeConfirmationDelegate, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods); }
/// <summary> /// Creates the file installer to use to install the mod's files. /// </summary> /// <remarks> /// This returns the upgrade <see cref="ModFileUpgradeInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected override IModFileInstaller CreateFileInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(new ModFileUpgradeInstaller(GameMode.GameModeEnvironmentInfo, Mod, ModInstallLog, PluginManager, new DataFileUtil(GameMode.GameModeEnvironmentInfo.InstallationPath), p_tfmFileManager, p_dlgOverwriteConfirmationDelegate, GameMode.UsesPlugins)); }
/// <summary> /// Reactivates the given mod. /// </summary> /// <remarks> /// A reactivation is an upgrade of a mod to itself. It re-runs the activation, /// without changing the installed precedence of its files and installed values. /// </remarks> /// <param name="p_modMod">The mod to reactivate.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ReactivateMod(IMod p_modMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { if (!InstallationLog.ActiveMods.Contains(p_modMod)) throw new InvalidOperationException(String.Format("Cannot reactivate the given mod, {0}. It is not active.", p_modMod.ModName)); ModActivator marActivator = new ModActivator(InstallationLog, InstallerFactory); return marActivator.Reactivate(p_modMod, p_dlgOverwriteConfirmationDelegate); }
/// <summary> /// Creates the file installer to use to install the mod's ini edits. /// </summary> /// <remarks> /// This returns the upgrade <see cref="IniUpgradeInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected override IIniInstaller CreateIniInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(new IniUpgradeInstaller(Mod, ModInstallLog, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate)); }
/// <summary> /// Creates the file installer to use to install the mod's files. /// </summary> /// <remarks> /// This returns the regular <see cref="ModFileInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected virtual IModFileInstaller CreateFileInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return new ModFileInstaller(GameMode.GameModeEnvironmentInfo, Mod, ModInstallLog, PluginManager, new DataFileUtil(GameMode.GameModeEnvironmentInfo.InstallationPath), p_tfmFileManager, p_dlgOverwriteConfirmationDelegate, GameMode.UsesPlugins, m_mmModManager); }
/// <summary> /// Creates the file installer to use to install the mod's game specific value edits. /// </summary> /// <remarks> /// This returns an upgrade <see cref="IGameSpecificValueInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected override IGameSpecificValueInstaller CreateGameSpecificValueInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(GameMode.GetGameSpecificValueUpgradeInstaller(Mod, ModInstallLog, p_tfmFileManager, new NexusFileUtil(EnvironmentInfo), p_dlgOverwriteConfirmationDelegate)); }
/// <summary> /// Creates the file installer to use to install the mod's game specific value edits. /// </summary> /// <remarks> /// This returns a regular <see cref="IGameSpecificValueInstaller"/>. /// </remarks> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>The file installer to use to install the mod's files.</returns> protected virtual IGameSpecificValueInstaller CreateGameSpecificValueInstaller(TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return GameMode.GetGameSpecificValueInstaller(Mod, ModInstallLog, p_tfmFileManager, new NexusFileUtil(EnvironmentInfo), p_dlgOverwriteConfirmationDelegate); }
/// <summary> /// Forces an upgrade from one mod to another. /// </summary> /// <remarks> /// No checks as to whether the two mods are actually related are performed. The new mod is reactivated /// as if it were the old mod, and the old mod is replaced by the new mod. /// </remarks> /// <param name="p_modOldMod">The mod from which to upgrade.</param> /// <param name="p_modNewMod">The mod to which to upgrade.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ForceUpgrade(IMod p_modOldMod, IMod p_modNewMod, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return(Activator.ForceUpgrade(p_modOldMod, p_modNewMod, p_dlgOverwriteConfirmationDelegate)); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public GamebryoGameSpecificValueInstaller(IMod p_modMod, IGameModeEnvironmentInfo p_gmiGameModeInfo, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { TouchedFiles = new Set<string>(StringComparer.OrdinalIgnoreCase); Mod = p_modMod; GameModeInfo = p_gmiGameModeInfo; InstallLog = p_ilgInstallLog; TransactionalFileManager = p_tfmFileManager; FileUtility = p_futFileUtility; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate; }
/// <summary> /// Runs the managed updaters. /// </summary> /// <param name="p_rolModList">The mod list.</param> /// <param name="p_camConfirm">The delegate to call to confirm an action.</param> /// <returns>The background task that will run the updaters.</returns> public IBackgroundTask ActivateMultipleMods(List <IMod> p_lstModList, bool p_booAllowCancel, ConfirmActionMethod p_camConfirm, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { ActivateMultipleModsTask ammActivateAllMods = new ActivateMultipleModsTask(p_lstModList, p_booAllowCancel, this.InstallationLog, this.InstallerFactory, p_camConfirm, p_dlgOverwriteConfirmationDelegate); ammActivateAllMods.Update(p_camConfirm); return(ammActivateAllMods); }
/// <summary> /// Gets the installer to use to install game specific values. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log the installation of the game specific values.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns>The installer to use to manage game specific values, or <c>null</c> if the game mode does not /// install any game specific values.</returns> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public override IGameSpecificValueInstaller GetGameSpecificValueInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return null; }
/// <summary> /// Activates the given mod. /// </summary> /// <param name="p_modMod">The mod to activate.</param> /// <param name="p_dlgUpgradeConfirmationDelegate">The delegate that is called to confirm whether an upgrade install should be performed.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> /// <param name="p_rolActiveMods">The list or Active mods.</param> /// <returns>A background task set allowing the caller to track the progress of the operation.</returns> public IBackgroundTaskSet ActivateMod(IMod p_modMod, ConfirmModUpgradeDelegate p_dlgUpgradeConfirmationDelegate, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, ReadOnlyObservableList <IMod> p_rolActiveMods) { if (InstallationLog.ActiveMods.Contains(p_modMod)) { return(null); } DeleteXMLInstalledFile(p_modMod); return(Activator.Activate(p_modMod, p_dlgUpgradeConfirmationDelegate, p_dlgOverwriteConfirmationDelegate, p_rolActiveMods, false)); }
/// <summary> /// Gets the installer to use to upgrade game specific values. /// </summary> /// <param name="p_modMod">The mod being upgraded.</param> /// <param name="p_ilgInstallLog">The install log to use to log the installation of the game specific values.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <returns>The installer to use to manage game specific values, or <c>null</c> if the game mode does not /// install any game specific values.</returns> /// <param name="p_futFileUtility">The file utility class.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public override IGameSpecificValueInstaller GetGameSpecificValueUpgradeInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, TxFileManager p_tfmFileManager, FileUtil p_futFileUtility, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { return new GamebryoGameSpecificValueInstaller(p_modMod, GameModeEnvironmentInfo, p_ilgInstallLog, p_tfmFileManager, p_futFileUtility, p_dlgOverwriteConfirmationDelegate); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_modMod">The mod being installed.</param> /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param> /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param> /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param> public IniInstaller(IMod p_modMod, IInstallLog p_ilgInstallLog, IVirtualModActivator p_ivaVirtualModActivator, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate) { TouchedFiles = new Set <string>(StringComparer.OrdinalIgnoreCase); Mod = p_modMod; InstallLog = p_ilgInstallLog; VirtualModActivator = p_ivaVirtualModActivator; TransactionalFileManager = p_tfmFileManager; m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No); }