/// <summary> /// Removes the upgrading given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveQueuedTaskUpg(ModUpgrader p_tskTask) { if (ModActivationMonitor.CanRemoveQueuedUpg(p_tskTask)) { ModActivationMonitor.RemoveQueuedTaskUpg(p_tskTask); } }
/// <summary> /// Removes the uninstalling given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveQueuedTaskUn(ModUninstaller p_tskTask) { if (ModActivationMonitor.CanRemoveQueuedUn(p_tskTask)) { ModActivationMonitor.RemoveQueuedTaskUn(p_tskTask); } }
/// <summary> /// Removes the given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveTask(ModInstaller p_tskTask) { if (ModActivationMonitor.CanRemove(p_tskTask)) { ModActivationMonitor.RemoveTask(p_tskTask); } }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_amnModActivationMonitor">The Activate Mods manager to use to manage the monitored activities.</param> /// <param name="p_setSettings">The application and user settings.</param> public ModActivationMonitorVM(ModActivationMonitor p_amnModActivationMonitor, ISettings p_setSettings, ModManager p_mmgModManager) { ModActivationMonitor = p_amnModActivationMonitor; Settings = p_setSettings; m_mmgModManager = p_mmgModManager; ModActivationMonitor.PropertyChanged += new PropertyChangedEventHandler(ActiveTasks_PropertyChanged); }
/// <summary> /// A simpell constructor that initializes the object with the given services. /// </summary> /// <param name="p_ilgModInstallLog">The install log that tracks mod install info for the current game mode.</param> /// <param name="p_aplActivePluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the current game mode.</param> /// <param name="p_polPluginOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the current game mode.</param> /// <param name="p_mrpModRepository">The repository we are logging in to.</param> /// <param name="p_mmgModManager">The mod manager to use to manage mods.</param> /// <param name="p_pmgPluginManager">The manager to use to manage plugins.</param> /// <param name="p_amtMonitor">The download monitor to use to manage the monitored activities.</param> /// <param name="p_mamMonitor">The mod activation monitor to use to manage the monitored activities.</param> /// <param name="p_umgUpdateManager">The update manager to use to perform updates.</param> public ServiceManager(IInstallLog p_ilgModInstallLog, ActivePluginLog p_aplActivePluginLog, IPluginOrderLog p_polPluginOrderLog, IModRepository p_mrpModRepository, ModManager p_mmgModManager, IPluginManager p_pmgPluginManager, DownloadMonitor p_amtMonitor, ModActivationMonitor p_mamMonitor) { ModInstallLog = p_ilgModInstallLog; ActivePluginLog = p_aplActivePluginLog; PluginOrderLog = p_polPluginOrderLog; ModRepository = p_mrpModRepository; ModManager = p_mmgModManager; PluginManager = p_pmgPluginManager; DownloadMonitor = p_amtMonitor; ModActivationMonitor = p_mamMonitor; }
/// <summary> /// Removes the upgrading given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveSelectedTaskUpg(ModUpgrader p_tskTask) { if (ModActivationMonitor.CanRemoveSelectedUpg(p_tskTask)) { if (p_tskTask.IsCompleted) { ModActivationMonitor.RemoveTaskUpg(p_tskTask); } else if (p_tskTask.IsQueued) { ModActivationMonitor.RemoveQueuedTaskUpg(p_tskTask); } } }
/// <summary> /// Removes the given task. /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveSelectedTask(ModInstaller p_tskTask) { if (ModActivationMonitor.CanRemoveSelected(p_tskTask)) { if (p_tskTask.IsCompleted) { ModActivationMonitor.RemoveTask(p_tskTask); } else if (p_tskTask.IsQueued) { ModActivationMonitor.RemoveQueuedTask(p_tskTask); } } }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param> /// <param name="p_dmrMonitor">The download monitor to use to track task progress.</param> /// <param name="p_mamMonitor">The mod activation monitor to use to track task progress.</param> /// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list /// of supported <see cref="IModFormat"/>s.</param> /// <param name="p_mdrManagedModRegistry">The <see cref="ModRegistry"/> that contains the list /// of managed <see cref="IMod"/>s.</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_ilgInstallLog">The install log tracking mod activations for the current game mode.</param> /// <param name="p_pmgPluginManager">The plugin manager to use to work with plugins.</param> private ModManager(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ModActivationMonitor p_mamMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mdrManagedModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager) { GameMode = p_gmdGameMode; EnvironmentInfo = p_eifEnvironmentInfo; m_rmmReadMeManager = new ReadMeManager(EnvironmentInfo.Settings.ModFolder[GameMode.ModeId]); ModRepository = p_mrpModRepository; FormatRegistry = p_frgFormatRegistry; ManagedModRegistry = p_mdrManagedModRegistry; InstallationLog = p_ilgInstallLog; m_vmaVirtualModActivator = new VirtualModActivator(this, p_pmgPluginManager, p_gmdGameMode, p_ilgInstallLog, p_eifEnvironmentInfo, EnvironmentInfo.Settings.ModFolder[GameMode.ModeId]); m_vmaVirtualModActivator.Initialize(); InstallerFactory = new ModInstallerFactory(p_gmdGameMode, p_eifEnvironmentInfo, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager, m_vmaVirtualModActivator); DownloadMonitor = p_dmrMonitor; ModActivationMonitor = p_mamMonitor; ModAdditionQueue = new AddModQueue(p_eifEnvironmentInfo, this); AutoUpdater = new AutoUpdater(p_mrpModRepository, p_mdrManagedModRegistry, p_eifEnvironmentInfo); LoginTask = new LoginFormTask(this); }
/// <summary> /// Initializes the singleton intances of the mod manager. /// </summary> /// <param name="p_gmdGameMode">The current game mode.</param> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param> /// <param name="p_dmrMonitor">The download monitor to use to track task progress.</param> /// <param name="p_mamMonitor">The mod activation monitor to use to track task progress.</param> /// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list /// of supported <see cref="IModFormat"/>s.</param> /// <param name="p_mrgModRegistry">The <see cref="ModRegistry"/> that contains the list /// of managed <see cref="IMod"/>s.</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_ilgInstallLog">The install log tracking mod activations for the current game mode.</param> /// <param name="p_pmgPluginManager">The plugin manager to use to work with plugins.</param> /// <returns>The initialized mod manager.</returns> /// <exception cref="InvalidOperationException">Thrown if the mod manager has already /// been initialized.</exception> public static ModManager Initialize(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ModActivationMonitor p_mamMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mrgModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager) { if (m_mmgCurrent != null) { throw new InvalidOperationException("The Mod Manager has already been initialized."); } m_mmgCurrent = new ModManager(p_gmdGameMode, p_eifEnvironmentInfo, p_mrpModRepository, p_dmrMonitor, p_mamMonitor, p_frgFormatRegistry, p_mrgModRegistry, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager); return(m_mmgCurrent); }
/// <summary> /// A simple constructor that initializes the object with the given dependencies. /// </summary> /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param> /// <param name="p_gmrInstalledGames">The registry of insalled games.</param> /// <param name="p_gmdGameMode">The game mode currently being managed.</param> /// <param name="p_mrpModRepository">The repository we are logging in to.</param> /// <param name="p_dmtMonitor">The download monitor to use to track task progress.</param> /// <param name="p_umgUpdateManager">The update manager to use to perform updates.</param> /// <param name="p_mmgModManager">The <see cref="ModManager"/> to use to manage mods.</param> /// <param name="p_pmgPluginManager">The <see cref="PluginManager"/> to use to manage plugins.</param> public MainFormVM(IEnvironmentInfo p_eifEnvironmentInfo, GameModeRegistry p_gmrInstalledGames, IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, DownloadMonitor p_dmtMonitor, ModActivationMonitor p_mamMonitor, UpdateManager p_umgUpdateManager, ModManager p_mmgModManager, IPluginManager p_pmgPluginManager) { EnvironmentInfo = p_eifEnvironmentInfo; GameMode = p_gmdGameMode; GameMode.GameLauncher.GameLaunching += new CancelEventHandler(GameLauncher_GameLaunching); ModManager = p_mmgModManager; PluginManager = p_pmgPluginManager; ProfileManager = new ProfileManager(ModManager.VirtualModActivator, ModManager, p_eifEnvironmentInfo.Settings.ModFolder[GameMode.ModeId], GameMode.UsesPlugins); ModManager.SetProfileManager(ProfileManager); ModRepository = p_mrpModRepository; UpdateManager = p_umgUpdateManager; ModManagerVM = new ModManagerVM(p_mmgModManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode.ModeTheme); DownloadMonitorVM = new DownloadMonitorVM(p_dmtMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager, p_mrpModRepository); ModActivationMonitor = p_mamMonitor; ModActivationMonitorVM = new ModActivationMonitorVM(p_mamMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager); if (GameMode.UsesPlugins) { PluginManagerVM = new PluginManagerVM(p_pmgPluginManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode, p_mamMonitor, ModManager.VirtualModActivator); } ProfileManagerVM = new ProfileManagerVM(ProfileManager, ModManager.ManagedMods, ModRepository, p_eifEnvironmentInfo.Settings, p_gmdGameMode.ModeTheme); HelpInfo = new HelpInformation(p_eifEnvironmentInfo); GeneralSettingsGroup gsgGeneralSettings = new GeneralSettingsGroup(p_eifEnvironmentInfo); foreach (IModFormat mftFormat in p_mmgModManager.ModFormats) { gsgGeneralSettings.AddFileAssociation(mftFormat.Extension, mftFormat.Name); } ModOptionsSettingsGroup mosModOptions = new ModOptionsSettingsGroup(p_eifEnvironmentInfo); List <ISettingsGroupView> lstSettingGroups = new List <ISettingsGroupView>(); lstSettingGroups.Add(new GeneralSettingsPage(gsgGeneralSettings)); lstSettingGroups.Add(new ModOptionsPage(mosModOptions)); DownloadSettingsGroup dsgDownloadSettings = new DownloadSettingsGroup(p_eifEnvironmentInfo, ModRepository); lstSettingGroups.Add(new DownloadSettingsPage(dsgDownloadSettings)); if (p_gmdGameMode.SettingsGroupViews != null) { lstSettingGroups.AddRange(p_gmdGameMode.SettingsGroupViews); } SettingsFormVM = new SettingsFormVM(p_gmdGameMode, p_eifEnvironmentInfo, lstSettingGroups); UpdateCommand = new Command("Update", String.Format("Update {0}", EnvironmentInfo.Settings.ModManagerName), UpdateProgramme); LogoutCommand = new Command("Logout", "Logout", Logout); List <Command> lstChangeGameModeCommands = new List <Command>(); List <IGameModeDescriptor> lstSortedModes = new List <IGameModeDescriptor>(p_gmrInstalledGames.RegisteredGameModes); lstSortedModes.Sort((x, y) => x.Name.CompareTo(y.Name)); foreach (IGameModeDescriptor gmdInstalledGame in lstSortedModes) { string strId = gmdInstalledGame.ModeId; string strName = gmdInstalledGame.Name; string strDescription = String.Format("Change game to {0}", gmdInstalledGame.Name); Image imgCommandIcon = new Icon(gmdInstalledGame.ModeTheme.Icon, 32, 32).ToBitmap(); lstChangeGameModeCommands.Add(new Command(strId, strName, strDescription, imgCommandIcon, () => ChangeGameMode(strId), true)); } lstChangeGameModeCommands.Add(new Command("Change Default Game...", "Change Default Game", () => ChangeGameMode(CHANGE_DEFAULT_GAME_MODE))); lstChangeGameModeCommands.Add(new Command("Rescan Installed Games...", "Rescan Installed Games", () => ChangeGameMode(RESCAN_INSTALLED_GAMES))); ChangeGameModeCommands = lstChangeGameModeCommands; }
/// <summary> /// Removes the given upgrading task (the task is already in queue or running). /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveUselessTaskUpg(ModUpgrader p_tskTask) { ModActivationMonitor.RemoveUselessTaskUpg(p_tskTask); }
/// <summary> /// Removes the given uninstalling task (the task is already in queue or running). /// </summary> /// <param name="p_tskTask">BasicInstallTask task to remove.</param> public void RemoveUselessTaskUn(ModUninstaller p_tskTask) { ModActivationMonitor.RemoveUselessTaskUn(p_tskTask); }