コード例 #1
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_AutoUpdater">The AutoUpdater.</param>
 /// <param name="p_ModRepository">The current mod repository.</param>
 /// <param name="p_lstModList">The list of mods we need to update.</param>
 /// <param name="p_booOverrideCategorySetup">Whether to force a global update.</param>
 public CategoriesUpdateCheckTask(CategoryManager p_cmCategoryManager, IProfileManager p_prmProfileManager, IModRepository p_ModRepository, string p_strCurrentGameModeModDirectory)
 {
     ModRepository               = p_ModRepository;
     ProfileManager              = p_prmProfileManager;
     CategoryManager             = p_cmCategoryManager;
     CurrentGameModeModDirectory = p_strCurrentGameModeModDirectory;
 }
コード例 #2
0
		/// <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_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, ActivateModsMonitor p_ammMonitor, 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_ammMonitor, p_frgFormatRegistry, p_mrgModRegistry, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager);
			return m_mmgCurrent;
		}
コード例 #3
0
ファイル: MainFormVM.cs プロジェクト: hackerlank/nmm
        /// <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, ActivateModsMonitor p_ammMonitor, 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;
            ModRepository = p_mrpModRepository;
            UpdateManager = p_umgUpdateManager;
            ModManagerVM  = new ModManagerVM(p_mmgModManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode.ModeTheme);
            if (GameMode.UsesPlugins)
            {
                PluginManagerVM = new PluginManagerVM(p_pmgPluginManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode);
            }
            DownloadMonitorVM     = new DownloadMonitorVM(p_dmtMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager, p_mrpModRepository);
            ActivateModsMonitorVM = new ActivateModsMonitorVM(p_ammMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager);
            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;
        }
コード例 #4
0
		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_AutoUpdater">The AutoUpdater.</param>
		/// <param name="p_ModRepository">The current mod repository.</param>
		/// <param name="p_lstModList">The list of mods we need to update.</param>
		/// <param name="p_booOverrideCategorySetup">Whether to force a global update.</param>
		public ModUpdateCheckTask(AutoUpdater p_AutoUpdater, IModRepository p_ModRepository, List<IMod> p_lstModList, bool p_booOverrideCategorySetup)
		{
			AutoUpdater = p_AutoUpdater;
			ModRepository = p_ModRepository;
			m_lstModList.AddRange(p_lstModList);
			m_booOverrideCategorySetup = p_booOverrideCategorySetup;
		}
コード例 #5
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_AutoUpdater">The AutoUpdater.</param>
 /// <param name="p_ModRepository">The current mod repository.</param>
 /// <param name="p_lstModList">The list of mods we need to update.</param>
 /// <param name="p_booOverrideCategorySetup">Whether to force a global update.</param>
 public ModUpdateCheckTask(AutoUpdater p_AutoUpdater, IModRepository p_ModRepository, List <IMod> p_lstModList, bool p_booOverrideCategorySetup)
 {
     AutoUpdater   = p_AutoUpdater;
     ModRepository = p_ModRepository;
     m_lstModList.AddRange(p_lstModList);
     m_booOverrideCategorySetup = p_booOverrideCategorySetup;
 }
コード例 #6
0
ファイル: AutoUpdater.cs プロジェクト: mumu/Nexus-Mod-Manager
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param>
 /// <param name="p_mrgModRegistry">The <see cref="ModRegistry"/> that contains the list
 /// of managed <see cref="IMod"/>s.</param>
 /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
 public AutoUpdater(IModRepository p_mrpModRepository, ModRegistry p_mrgModRegistry, IEnvironmentInfo p_eifEnvironmentInfo)
 {
     ModRepository      = p_mrpModRepository;
     ManagedModRegistry = p_mrgModRegistry;
     EnvironmentInfo    = p_eifEnvironmentInfo;
     ManagedModRegistry.RegisteredMods.CollectionChanged += new NotifyCollectionChangedEventHandler(RegisteredMods_CollectionChanged);
     NewestModInfo = new ReadOnlyObservableList <UpdateInfo>(m_oclNewInfo);
 }
コード例 #7
0
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_intMaxConnections">The maximum number of connections to use to download the file.</param>
 /// <param name="p_intMinBlockSize">The minimum block size that should be downloaded at once. This should
 /// ideally be some mulitple of the available bandwidth.</param>
 /// <param name="p_strUserAgent">The current User Agent.</param>
 public FileDownloadTask(IModRepository p_mmrModRepository, Int32 p_intMaxConnections, Int32 p_intMinBlockSize, string p_strUserAgent)
 {
     m_intMaxConnections   = p_intMaxConnections;
     m_intMinBlockSize     = p_intMinBlockSize;
     m_strUserAgent        = p_strUserAgent;
     m_tmrUpdater.Elapsed += new ElapsedEventHandler(Updater_Elapsed);
     ModRepository         = p_mmrModRepository;
 }
コード例 #8
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public CheckOnlineProfileIntegrityTask(IModRepository p_mrRepository, IModProfile p_imProfile, IProfileManager p_pmProfileManager, Dictionary <string, string> p_dicMissingMod, string p_strGameModeID)
 {
     ModRepository   = p_mrRepository;
     ModProfile      = p_imProfile;
     MissingModsList = p_dicMissingMod;
     GameModeID      = p_strGameModeID;
     ProfileManager  = p_pmProfileManager;
 }
コード例 #9
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_mmdProfileManager">The mod manager to use to manage mods.</param>
 /// <param name="p_setSettings">The application and user settings.</param>
 /// <param name="p_thmTheme">The current theme to use for the views.</param>
 public ProfileManagerVM(IProfileManager p_mmdProfileManager, ReadOnlyObservableList <IMod> p_rolManagedMods, IModRepository p_mmrModRepository, ISettings p_setSettings, Theme p_thmTheme)
 {
     ProfileManager = p_mmdProfileManager;
     ModRepository  = p_mmrModRepository;
     Settings       = p_setSettings;
     CurrentTheme   = p_thmTheme;
     ManagedMods    = p_rolManagedMods;
 }
コード例 #10
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public AddProfileTask(ModManager p_mmgModManager, IModRepository p_mrModRepository, IEnvironmentInfo p_eiEnvironmentInfo, ProfileManager p_pmProfileManager, Uri p_uUri, ConfirmActionMethod p_camConfirm, string p_strLabel)
 {
     ModManager          = p_mmgModManager;
     ModRepository       = p_mrModRepository;
     EnvironmentInfo     = p_eiEnvironmentInfo;
     ProfileManager      = p_pmProfileManager;
     m_Uri               = p_uUri;
     ConfirmActionMethod = p_camConfirm;
 }
コード例 #11
0
ファイル: ModController.cs プロジェクト: nojan1/Mineman
 public ModController(IModRepository modRepository,
                      IOptions <PathOptions> pathOptions,
                      IHostingEnvironment environment,
                      ILogger <ModController> logger)
 {
     _modRepository = modRepository;
     _pathOptions   = pathOptions.Value;
     _environment   = environment;
     _logger        = logger;
 }
コード例 #12
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_AutoUpdater">The AutoUpdater.</param>
 /// <param name="p_ModRepository">The current mod repository.</param>
 /// <param name="p_lstModList">The list of mods we need to update.</param>
 /// <param name="p_booOverrideCategorySetup">Whether to force a global update.</param>
 public ModUpdateCheckTask(AutoUpdater p_AutoUpdater, IProfileManager p_prmProfileManager, IModRepository p_ModRepository, List <IMod> p_lstModList, bool p_booOverrideCategorySetup, bool?p_booMissingDownloadId, bool p_booOverrideLocalModNames)
 {
     AutoUpdater    = p_AutoUpdater;
     ModRepository  = p_ModRepository;
     ProfileManager = p_prmProfileManager;
     m_lstModList.AddRange(p_lstModList);
     m_booOverrideCategorySetup = p_booOverrideCategorySetup;
     m_booMissingDownloadId     = p_booMissingDownloadId;
     OverrideLocalModNames      = p_booOverrideLocalModNames;
 }
コード例 #13
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="autoUpdater">The AutoUpdater.</param>
 /// <param name="modRepository">The current mod repository.</param>
 /// <param name="modList">The list of mods we need to update.</param>
 /// <param name="overrideCategorySetup">Whether to force a global update.</param>
 /// <inheritdoc />
 public ModUpdateCheckTask(AutoUpdater autoUpdater, IProfileManager profileManager, IModRepository modRepository, IEnumerable <IMod> modList, string period, bool overrideCategorySetup, bool?missingDownloadId, bool overrideLocalModNames)
 {
     AutoUpdater    = autoUpdater;
     ModRepository  = modRepository;
     ProfileManager = profileManager;
     _period        = period;
     _modList.AddRange(modList);
     _overrideCategorySetup = overrideCategorySetup;
     _missingDownloadId     = missingDownloadId;
     _overrideLocalModNames = overrideLocalModNames;
 }
コード例 #14
0
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
 /// <param name="p_mrpModRepository">The repository we are logging in to.</param>
 /// <param name="p_thmTheme">The theme to use for the UI.</param>
 /// <param name="p_strPrompt">The prompt to display to the user.</param>
 /// <param name="p_strError">The error to display.</param>
 /// <param name="p_strCancelWarning">The warning to display if the user tries to cancel the login.</param>
 public LoginFormVM(IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, Theme p_thmTheme, string p_strPrompt, string p_strError, string p_strCancelWarning)
 {
     EnvironmentInfo = p_eifEnvironmentInfo;
     ModRepository   = p_mrpModRepository;
     CurrentTheme    = p_thmTheme;
     Prompt          = p_strPrompt;
     ErrorMessage    = p_strError;
     CancelWarning   = p_strCancelWarning;
     Username        = EnvironmentInfo.Settings.RepositoryUsernames[ModRepository.Id];
     StayLoggedIn    = EnvironmentInfo.Settings.RepositoryAuthenticationTokens.ContainsKey(ModRepository.Id);
 }
コード例 #15
0
        /// <summary>
        /// Setup the CategoryView
        /// </summary>
        /// <param name="p_lvwList">The source list view.</param>
        /// <param name="p_cmgCategoryManager">The mod Category Manager.</param>
        public void Setup(ReadOnlyObservableList <IMod> p_rolManagedMods, ReadOnlyObservableList <IMod> p_rolActiveMods, IModRepository p_mmrModRepository, CategoryManager p_cmgCategoryManager, ISettings p_Settings)
        {
            this.Tag = false;

            this.CellEditActivation = CellEditActivateMode.None;
            this.MultiSelect        = true;
            this.AllowDrop          = true;
            this.UseFiltering       = true;

            CategoryManager    = p_cmgCategoryManager;
            m_mmrModRepository = p_mmrModRepository;
            m_rolManagedMods   = p_rolManagedMods;
            m_rolActiveMods    = p_rolActiveMods;
            Settings           = p_Settings;

            // Setup menuStrip commands
            SetupContextMenu();

            // Setup category validator
            SetupCategoryValidator();

            // Setup category sorter
            SetupCategorySorter();

            this.CheckBoxes              = false;
            this.UseSubItemCheckBoxes    = false;
            this.BooleanCheckStateGetter = delegate(object x)
            {
                if (x.GetType() != typeof(ModCategory))
                {
                    if (m_rolActiveMods.Contains((IMod)x))
                    {
                        return(true);
                    }
                }

                return(false);
            };

            // Setup AspectGetter (IconListView cell parser)
            SetupColumnParser();

            // Setup the Drag&Drop functionality
            SetupDragAndDrop();

            // Setup hyperlink manager
            SetupHyperlinkManager();

            // Setup ImageGetters
            SetupImageGetters();

            // Set control initialized
            this.Tag = true;
        }
コード例 #16
0
 /// <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;
 }
コード例 #17
0
        /// <summary>
        /// A simple constructor that initializes the object with the given dependencies.
        /// </summary>
        /// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
        public DownloadSettingsGroup(IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mmrModRepository)
            : base(p_eifEnvironmentInfo)
        {
            m_mmrModRepository = p_mmrModRepository;
            m_mmrModRepository.UserStatusUpdate += new EventHandler(m_mmrModRepository_UserStatusUpdate);

            if (LoadRepositorySettings())
            {
                Load();
                Save();
            }
        }
コード例 #18
0
        /// <summary>
        /// Setup the ProfileView
        /// </summary>
        /// <param name="p_lvwList">The source list view.</param>
        /// <param name="p_cmgProfileManager">The mod Profile Manager.</param>
        public void Setup(ReadOnlyObservableList <IMod> p_rolManagedMods, IModRepository p_mmrModRepository, IProfileManager p_cmgProfileManager, ISettings p_Settings)
        {
            this.Tag = false;

            this.CellEditActivation = CellEditActivateMode.None;
            this.MultiSelect        = true;
            this.AllowDrop          = true;
            this.UseFiltering       = true;
            this.UseHyperlinks      = true;

            ProfileManager     = p_cmgProfileManager;
            m_mmrModRepository = p_mmrModRepository;
            m_rolManagedMods   = p_rolManagedMods;
            Settings           = p_Settings;

            // Setup menuStrip commands
            SetupContextMenu();

            // Setup Profile validator
            SetupProfileValidator();

            // Setup Profile sorter
            SetupProfileSorter();

            this.CheckBoxes           = false;
            this.UseSubItemCheckBoxes = false;

            this.FormatRow += delegate(object sender, FormatRowEventArgs e)
            {
                IVirtualModInfo modInfo = (IVirtualModInfo)e.Model;
                var             modMod  = ManagedMods.Where(x => String.Equals(Path.GetFileName(x.Filename), modInfo.ModFileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
                if (modMod == null)
                {
                    e.Item.ForeColor = Color.Gray;
                }
            };

            // Setup AspectGetter (IconListView cell parser)
            SetupColumnParser();

            // Setup the Drag&Drop functionality
            SetupDragAndDrop();

            // Setup hyperlink manager
            SetupHyperlinkManager();

            // Setup ImageGetters
            SetupImageGetters();

            // Set control initialized
            this.Tag = true;
            this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
コード例 #19
0
        /// <summary>
        /// A simple constructor that initializes the object with its dependencies.
        /// </summary>
        /// <param name="p_amnDownloadMonitor">The Download manager to use to manage the monitored activities.</param>
        /// <param name="p_setSettings">The application and user settings.</param>
        public DownloadMonitorVM(DownloadMonitor p_amnDownloadMonitor, ISettings p_setSettings, ModManager p_mmgModManager, IModRepository p_mrpModRepository)
        {
            DownloadMonitor = p_amnDownloadMonitor;
            Settings        = p_setSettings;
            m_mmgModManager = p_mmgModManager;
            ModRepository   = p_mrpModRepository;
            ModRepository.UserStatusUpdate  += new System.EventHandler(ModRepository_UserStatusUpdate);
            DownloadMonitor.PropertyChanged += new PropertyChangedEventHandler(ActiveTasks_PropertyChanged);

            CancelTaskCommand = new Command <AddModTask>("Cancel", "Cancels the selected Download.", CancelTask);
            RemoveTaskCommand = new Command <AddModTask>("Remove", "Removes the selected Download.", RemoveTask);
            PauseTaskCommand  = new Command <AddModTask>("Pause", "Pauses the selected Download.", PauseTask);
            ResumeTaskCommand = new Command <AddModTask>("Resume", "Resumes the selected Download.", ResumeTask);
        }
コード例 #20
0
 /// <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_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, ActivateModsMonitor p_ammMonitor, 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;
     InstallerFactory    = new ModInstallerFactory(p_gmdGameMode, p_eifEnvironmentInfo, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager, this);
     DownloadMonitor     = p_dmrMonitor;
     ActivateModsMonitor = p_ammMonitor;
     ModAdditionQueue    = new AddModQueue(p_eifEnvironmentInfo, this);
     AutoUpdater         = new AutoUpdater(p_mrpModRepository, p_mdrManagedModRegistry, p_eifEnvironmentInfo);
     LoginTask           = new LoginFormTask(this);
 }
コード例 #21
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_gmdGameMode">The game mode for which mods are being managed.</param>
		/// <param name="p_rmmReadMeManager">The ReadMe Manager info.</param>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_mrgModRegistry">The <see cref="ModRegistry"/> that contains the list of managed <see cref="IMod"/>s.</param>
		/// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list
		/// of supported <see cref="IModFormat"/>s.</param>
		/// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param>
		/// <param name="p_uriPath">The path to the mod to add.</param>
		/// <param name="p_cocConfirmOverwrite">The delegate to call to resolve conflicts with existing files.</param>
		public AddModTask(IGameMode p_gmdGameMode, ReadMeManager p_rmmReadMeManager, IEnvironmentInfo p_eifEnvironmentInfo, ModRegistry p_mrgModRegistry, IModFormatRegistry p_frgFormatRegistry, IModRepository p_mrpModRepository, Uri p_uriPath, ConfirmOverwriteCallback p_cocConfirmOverwrite)
		{
			m_gmdGameMode = p_gmdGameMode;
			m_eifEnvironmentInfo = p_eifEnvironmentInfo;
			m_mrgModRegistry = p_mrgModRegistry;
			m_mfrModFormatRegistry = p_frgFormatRegistry;
			m_mrpModRepository = p_mrpModRepository;
			m_uriPath = p_uriPath;
			m_cocConfirmOverwrite = p_cocConfirmOverwrite;
			m_rmmReadMeManager = p_rmmReadMeManager;
			m_intLocalID = m_intCounter++;
		}
コード例 #22
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param>
		/// <param name="p_mrgModRegistry">The <see cref="ModRegistry"/> that contains the list
		/// of managed <see cref="IMod"/>s.</param>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		public AutoUpdater(IModRepository p_mrpModRepository, ModRegistry p_mrgModRegistry, IEnvironmentInfo p_eifEnvironmentInfo)
		{
			ModRepository = p_mrpModRepository;
			ManagedModRegistry = p_mrgModRegistry;
			EnvironmentInfo = p_eifEnvironmentInfo;
			ManagedModRegistry.RegisteredMods.CollectionChanged += new NotifyCollectionChangedEventHandler(RegisteredMods_CollectionChanged);
			NewestModInfo = new ReadOnlyObservableList<UpdateInfo>(m_oclNewInfo);
		}
コード例 #23
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 public CheckOnlineProfileIntegrityTask(IModRepository p_mrRepository, IModProfile p_imProfile, IProfileManager p_pmProfileManager)
 {
     ModRepository  = p_mrRepository;
     ModProfile     = p_imProfile;
     ProfileManager = p_pmProfileManager;
 }
コード例 #24
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_mrpModRepository">The repository we are logging in to.</param>
		/// <param name="p_thmTheme">The theme to use for the UI.</param>
		/// <param name="p_strPrompt">The prompt to display to the user.</param>
		/// <param name="p_strError">The error to display.</param>
		/// <param name="p_strCancelWarning">The warning to display if the user tries to cancel the login.</param>
		public LoginFormVM(IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, Theme p_thmTheme, string p_strPrompt, string p_strError, string p_strCancelWarning)
		{
			EnvironmentInfo = p_eifEnvironmentInfo;
			ModRepository = p_mrpModRepository;
			CurrentTheme = p_thmTheme;
			Prompt = p_strPrompt;
			ErrorMessage = p_strError;
			CancelWarning = p_strCancelWarning;
			Username = EnvironmentInfo.Settings.RepositoryUsernames[ModRepository.Id];
			StayLoggedIn = EnvironmentInfo.Settings.RepositoryAuthenticationTokens.ContainsKey(ModRepository.Id);
		}
コード例 #25
0
		/// <summary>
		/// A simple constructor that initializes the object with the given dependencies.
		/// </summary>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		public DownloadSettingsGroup(IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mmrModRepository)
			: base(p_eifEnvironmentInfo)
		{
			m_mmrModRepository = p_mmrModRepository;
			m_mmrModRepository.UserStatusUpdate += new EventHandler(m_mmrModRepository_UserStatusUpdate);

			if (LoadRepositorySettings())
			{
				Load();
				Save();
			}
		}
コード例 #26
0
 /// <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);
 }
コード例 #27
0
		/// <summary>
		/// A simple constructor that initializes the object wiht the given values.
		/// </summary>
		/// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param>
		public AutoTagger(IModRepository p_mrpModRepository)
		{
			ModRepository = p_mrpModRepository;
		}
コード例 #28
0
		/// <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_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, ActivateModsMonitor p_ammMonitor, 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;
            InstallerFactory = new ModInstallerFactory(p_gmdGameMode, p_eifEnvironmentInfo, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager, this);
			DownloadMonitor = p_dmrMonitor;
            ActivateModsMonitor = p_ammMonitor;
			ModAdditionQueue = new AddModQueue(p_eifEnvironmentInfo, this);
			AutoUpdater = new AutoUpdater(p_mrpModRepository, p_mdrManagedModRegistry, p_eifEnvironmentInfo);
            LoginTask = new LoginFormTask(this);
		}
コード例 #29
0
		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_amnDownloadMonitor">The Download manager to use to manage the monitored activities.</param>
		/// <param name="p_setSettings">The application and user settings.</param>
		public DownloadMonitorVM(DownloadMonitor p_amnDownloadMonitor, ISettings p_setSettings, ModManager p_mmgModManager, IModRepository p_mrpModRepository)
		{
			DownloadMonitor = p_amnDownloadMonitor;
			Settings = p_setSettings;
			m_mmgModManager = p_mmgModManager;
			ModRepository = p_mrpModRepository;
			ModRepository.UserStatusUpdate += new System.EventHandler(ModRepository_UserStatusUpdate);
			DownloadMonitor.PropertyChanged += new PropertyChangedEventHandler(ActiveTasks_PropertyChanged);

			CancelTaskCommand = new Command<AddModTask>("Cancel", "Cancels the selected Download.", CancelTask);
			RemoveTaskCommand = new Command<AddModTask>("Remove", "Removes the selected Download.", RemoveTask);
			PauseTaskCommand = new Command<AddModTask>("Pause", "Pauses the selected Download.", PauseTask);
			ResumeTaskCommand = new Command<AddModTask>("Resume", "Resumes the selected Download.", ResumeTask);
		}
コード例 #30
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public RemoveBackedProfileTask(IModRepository p_mrRepository, IModProfile p_impProfile, ProfileManager p_pmProfileManager)
 {
     ModRepository  = p_mrRepository;
     ModProfile     = p_impProfile;
     ProfileManager = p_pmProfileManager;
 }
コード例 #31
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_intMaxConnections">The maximum number of connections to use to download the file.</param>
		/// <param name="p_intMinBlockSize">The minimum block size that should be downloaded at once. This should
		/// ideally be some mulitple of the available bandwidth.</param>
		/// <param name="p_strUserAgent">The current User Agent.</param>
		public FileDownloadTask(IModRepository p_mmrModRepository, Int32 p_intMaxConnections, Int32 p_intMinBlockSize, string p_strUserAgent)
		{
			m_intMaxConnections = p_intMaxConnections;
			m_intMinBlockSize = p_intMinBlockSize;
			m_strUserAgent = p_strUserAgent;
			m_tmrUpdater.Elapsed += new ElapsedEventHandler(Updater_Elapsed);
			ModRepository = p_mmrModRepository;
		}
コード例 #32
0
		/// <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_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, ActivateModsMonitor p_ammMonitor, UpdateManager p_umgUpdateManager)
		{
			ModInstallLog = p_ilgModInstallLog;
			ActivePluginLog = p_aplActivePluginLog;
			PluginOrderLog = p_polPluginOrderLog;
			ModRepository = p_mrpModRepository;
			ModManager = p_mmgModManager;
			PluginManager = p_pmgPluginManager;
			DownloadMonitor = p_amtMonitor;
			UpdateManager = p_umgUpdateManager;
            ActivateModsMonitor = p_ammMonitor;
		}
コード例 #33
0
ファイル: ModAppService.cs プロジェクト: unicloud/FRP
 public ModAppService(IModQuery modQuery, IModRepository modRepository)
 {
     _modQuery = modQuery;
     _modRepository = modRepository;
 }
コード例 #34
0
		/// <summary>
		/// Logins the user into the current mod repository.
		/// </summary>
		/// <param name="p_gmdGameMode">The current game mode.</param>
		/// <param name="p_mrpModRepository">The mod repository to use to retrieve mods and mod metadata.</param>
		/// <returns><c>true</c> if the user was successfully logged in;
		/// <c>false</c> otherwise</returns>
		protected bool Login(IGameMode p_gmdGameMode, IModRepository p_mrpModRepository)
		{
			if (EnvironmentInfo.Settings.RepositoryAuthenticationTokens[p_mrpModRepository.Id] == null)
				EnvironmentInfo.Settings.RepositoryAuthenticationTokens[p_mrpModRepository.Id] = new KeyedSettings<string>();

			Dictionary<string, string> dicAuthTokens = new Dictionary<string, string>(EnvironmentInfo.Settings.RepositoryAuthenticationTokens[p_mrpModRepository.Id]);
			bool booCredentialsExpired = false;
			string strError = String.Empty;

			try
			{
				booCredentialsExpired = !p_mrpModRepository.Login(dicAuthTokens);
			}
			catch (RepositoryUnavailableException e)
			{
				strError = e.Message;
				dicAuthTokens.Clear();
			}

			if ((dicAuthTokens.Count == 0) || booCredentialsExpired)
			{
				string strMessage = String.Format("You must log into the {0} website.", p_mrpModRepository.Name);
				string strCancelWarning = String.Format("If you do not login {0} will close.", EnvironmentInfo.Settings.ModManagerName);
				strError = booCredentialsExpired ? "You need to login using your Nexus username and password." : strError;
				LoginFormVM vmlLoginVM = new LoginFormVM(EnvironmentInfo, p_mrpModRepository, p_gmdGameMode.ModeTheme, strMessage, strError, strCancelWarning);
				return LoginUser(vmlLoginVM);
			}
			return true;
		}
コード例 #35
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public ToggleSharingProfileTask(IModRepository p_mrRepository, ProfileManager p_pmProfileManager, IModProfile p_imProfile)
 {
     ModRepository  = p_mrRepository;
     ProfileManager = p_pmProfileManager;
     ModProfile     = p_imProfile;
 }
コード例 #36
0
ファイル: AutoTagger.cs プロジェクト: zua07/Nexus-Mod-Manager
 /// <summary>
 /// A simple constructor that initializes the object wiht the given values.
 /// </summary>
 /// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param>
 public AutoTagger(IModRepository p_mrpModRepository)
 {
     ModRepository = p_mrpModRepository;
 }
コード例 #37
0
		/// <summary>
		/// This initializes the services required to run the client.
		/// </summary>
		/// <param name="p_gmdGameMode">The game mode for which mods are being managed.</param>
		/// <param name="p_mrpModRepository">The mod repository to use to retrieve mods and mod metadata.</param>
		/// <param name="p_nfuFileUtility">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_vwmErrorMessage">The error message if the UAC check failed.</param>
		/// <returns>A <see cref="ServiceManager"/> containing the initialized services, or <c>null</c> if the
		/// services didn't initialize properly.</returns>
		protected ServiceManager InitializeServices(IGameMode p_gmdGameMode, IModRepository p_mrpModRepository, NexusFileUtil p_nfuFileUtility, SynchronizationContext p_scxUIContext, out ViewMessage p_vwmErrorMessage)
		{
			IModCacheManager mcmModCacheManager = new NexusModCacheManager(p_gmdGameMode.GameModeEnvironmentInfo.ModCacheDirectory, p_gmdGameMode.GameModeEnvironmentInfo.ModDirectory, p_nfuFileUtility);

			Trace.TraceInformation("Registering supported Script Types...");
			Trace.Indent();
			IScriptTypeRegistry stgScriptTypeRegistry = ScriptTypeRegistry.DiscoverScriptTypes(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ScriptTypes"), p_gmdGameMode);
			if (stgScriptTypeRegistry.Types.Count == 0)
			{
				p_vwmErrorMessage = new ViewMessage("No script types were found.", null, "No Script Types", MessageBoxIcon.Error);
				return null;
			}
			Trace.TraceInformation("Found {0} script types.", stgScriptTypeRegistry.Types.Count);
			Trace.Unindent();

			Trace.TraceInformation("Registering supported mod formats...");
			Trace.Indent();
			IModFormatRegistry mfrModFormatRegistry = ModFormatRegistry.DiscoverFormats(mcmModCacheManager, stgScriptTypeRegistry, Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ModFormats"));
			if (mfrModFormatRegistry.Formats.Count == 0)
			{
				p_vwmErrorMessage = new ViewMessage("No mod formats were found.", null, "No Mod Formats", MessageBoxIcon.Error);
				return null;
			}
			Trace.TraceInformation("Found {0} formats.", mfrModFormatRegistry.Formats.Count);
			Trace.Unindent();

			Trace.TraceInformation("Finding managed mods...");
			Trace.Indent();

			ModRegistry mrgModRegistry = null;
			try
			{
				mrgModRegistry = ModRegistry.DiscoverManagedMods(mfrModFormatRegistry, mcmModCacheManager, p_gmdGameMode.GameModeEnvironmentInfo.ModDirectory, EnvironmentInfo.Settings.ScanSubfoldersForMods, p_gmdGameMode, p_gmdGameMode.GameModeEnvironmentInfo.ModCacheDirectory, p_gmdGameMode.GameModeEnvironmentInfo.ModDownloadCacheDirectory, p_gmdGameMode.GameModeEnvironmentInfo.ModReadMeDirectory, p_gmdGameMode.GameModeEnvironmentInfo.CategoryDirectory);
			}
			catch (UnauthorizedAccessException ex)
			{
				p_vwmErrorMessage = new ViewMessage(String.Format("An error occured while retrieving managed mods: \n\n{0}", ex.Message), null, "Install Log", MessageBoxIcon.Error);
				return null;
			}

			Trace.TraceInformation("Found {0} managed mods.", mrgModRegistry.RegisteredMods.Count);
			Trace.Unindent();

			Trace.TraceInformation("Initializing Install Log...");
			Trace.Indent();
			Trace.TraceInformation("Checking if upgrade is required...");
			InstallLogUpgrader iluUgrader = new InstallLogUpgrader();

			string strLogPath = string.Empty;

			try
			{
				strLogPath = Path.Combine(p_gmdGameMode.GameModeEnvironmentInfo.InstallInfoDirectory, "InstallLog.xml");
			}
			catch (ArgumentNullException)
			{
				p_vwmErrorMessage = new ViewMessage("Unable to retrieve critical paths from the config file." + Environment.NewLine + "Select this game again to fix the folders setup.", null, "Config error", MessageBoxIcon.Warning);
				return null;
			}

			if (!InstallLog.IsLogValid(strLogPath))
				InstallLog.Restore(strLogPath);
			if (iluUgrader.NeedsUpgrade(strLogPath))
			{
				if (!iluUgrader.CanUpgrade(strLogPath))
				{
					p_vwmErrorMessage = new ViewMessage(String.Format("{0} does not support version {1} of the Install Log.", EnvironmentInfo.Settings.ModManagerName, InstallLog.ReadVersion(strLogPath)), null, "Install Log", MessageBoxIcon.Error);
					return null;
				}
				IBackgroundTask tskUpgrader = iluUgrader.UpgradeInstallLog(strLogPath, p_gmdGameMode.GameModeEnvironmentInfo.ModDirectory, mrgModRegistry);
				m_areTaskWait.Reset();
				tskUpgrader.TaskEnded += new EventHandler<TaskEndedEventArgs>(Task_TaskEnded);
				OnTaskStarted(tskUpgrader);
				if (tskUpgrader.IsActive)
					m_areTaskWait.WaitOne();
				tskUpgrader.TaskEnded -= new EventHandler<TaskEndedEventArgs>(Task_TaskEnded);
				if (tskUpgrader.Status != TaskStatus.Complete)
				{
					string strDetails = (string)(tskUpgrader.ReturnValue ?? null);
					p_vwmErrorMessage = new ViewMessage("Install Log was not upgraded.", strDetails, "Install Log", MessageBoxIcon.Error);
					return null;
				}
			}
			IInstallLog ilgInstallLog = InstallLog.Initialize(mrgModRegistry, p_gmdGameMode.GameModeEnvironmentInfo.ModDirectory, strLogPath);
			Trace.Unindent();

			Trace.TraceInformation("Initializing Plugin Management Services...");
			Trace.Indent();
			PluginRegistry prgPluginRegistry = null;
			IPluginOrderLog polPluginOrderLog = null;
			ActivePluginLog aplPluginLog = null;
			IPluginManager pmgPluginManager = null;
			if (!p_gmdGameMode.UsesPlugins)
				Trace.TraceInformation("Not required.");
			else
			{
				Trace.TraceInformation("Initializing Plugin Registry...");
				Trace.Indent();
				prgPluginRegistry = PluginRegistry.DiscoverManagedPlugins(p_gmdGameMode.GetPluginFactory(), p_gmdGameMode.GetPluginDiscoverer());
				Trace.TraceInformation("Found {0} managed plugins.", prgPluginRegistry.RegisteredPlugins.Count);
				Trace.Unindent();

				Trace.TraceInformation("Initializing Plugin Order Log...");
				Trace.Indent();
				polPluginOrderLog = PluginOrderLog.Initialize(prgPluginRegistry, p_gmdGameMode.GetPluginOrderLogSerializer(), p_gmdGameMode.GetPluginOrderValidator());
				Trace.Unindent();

				Trace.TraceInformation("Initializing Active Plugin Log...");
				Trace.Indent();
				aplPluginLog = ActivePluginLog.Initialize(prgPluginRegistry, p_gmdGameMode.GetActivePluginLogSerializer(polPluginOrderLog));
				Trace.Unindent();

				Trace.TraceInformation("Initializing Plugin Manager...");
				Trace.Indent();
				pmgPluginManager = PluginManager.Initialize(p_gmdGameMode, prgPluginRegistry, aplPluginLog, polPluginOrderLog, p_gmdGameMode.GetPluginOrderValidator());
				Trace.Unindent();
			}
			Trace.Unindent();

			Trace.TraceInformation("Initializing Activity Monitor...");
			Trace.Indent();
			DownloadMonitor dmtMonitor = new DownloadMonitor();
			Trace.Unindent();

            Trace.TraceInformation("Initializing Activate Mods Monitor...");
			Trace.Indent();
			ActivateModsMonitor ammMonitor = new ActivateModsMonitor();
			Trace.Unindent();

			Trace.TraceInformation("Initializing Mod Manager...");
			Trace.Indent();
            ModManager mmgModManager = ModManager.Initialize(p_gmdGameMode, EnvironmentInfo, p_mrpModRepository, dmtMonitor, ammMonitor, mfrModFormatRegistry, mrgModRegistry, p_nfuFileUtility, p_scxUIContext, ilgInstallLog, pmgPluginManager);
			Trace.Unindent();

			Trace.TraceInformation("Initializing Update Manager...");
			Trace.Indent();
			UpdateManager umgUpdateManager = new UpdateManager(p_gmdGameMode, EnvironmentInfo);
			Trace.Unindent();

			p_vwmErrorMessage = null;
            return new ServiceManager(ilgInstallLog, aplPluginLog, polPluginOrderLog, p_mrpModRepository, mmgModManager, pmgPluginManager, dmtMonitor, ammMonitor, umgUpdateManager);
		}
コード例 #38
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public RefreshBackedProfilesTask(IModRepository p_mrRepository, ProfileManager p_pmProfileManager)
 {
     ModRepository  = p_mrRepository;
     ProfileManager = p_pmProfileManager;
 }
コード例 #39
0
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_ModManager">The current ModManager.</param>
 /// <param name="p_lstMods">The mod list.</param>
 /// <param name="p_intNewValue">The new category id.</param>
 public RenameBackedProfileTask(IModRepository p_mrRepository, IModProfile p_impProfile, string p_strNewName)
 {
     ModRepository = p_mrRepository;
     ModProfile    = p_impProfile;
     NewName       = p_strNewName;
 }
コード例 #40
0
		/// <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, ActivateModsMonitor p_ammMonitor, 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;
			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_ammMonitor;
			ActivateModsMonitorVM = new ActivateModsMonitorVM(p_ammMonitor, p_eifEnvironmentInfo.Settings, p_mmgModManager);
			if (GameMode.UsesPlugins)
				PluginManagerVM = new PluginManagerVM(p_pmgPluginManager, p_eifEnvironmentInfo.Settings, p_gmdGameMode, p_ammMonitor);

			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;
		}
コード例 #41
0
		/// <summary>
		/// Setup the CategoryView
		/// </summary>
		/// <param name="p_lvwList">The source list view.</param>
		/// <param name="p_cmgCategoryManager">The mod Category Manager.</param>
		public void Setup(ReadOnlyObservableList<IMod> p_rolManagedMods, ReadOnlyObservableList<IMod> p_rolActiveMods, IModRepository p_mmrModRepository, CategoryManager p_cmgCategoryManager, ISettings p_Settings)
		{
			this.Tag = false;

			this.CellEditActivation = CellEditActivateMode.None;
			this.MultiSelect = true;
			this.AllowDrop = true;
			this.UseFiltering = true;

			CategoryManager = p_cmgCategoryManager;
			m_mmrModRepository = p_mmrModRepository;
			m_rolManagedMods = p_rolManagedMods;
			m_rolActiveMods = p_rolActiveMods;
			Settings = p_Settings;

			// Setup menuStrip commands
			SetupContextMenu();

			// Setup category validator
			SetupCategoryValidator();

			// Setup category sorter
			SetupCategorySorter();

			this.CheckBoxes = false;
			this.UseSubItemCheckBoxes = false;
			this.BooleanCheckStateGetter = delegate(object x)
			{
				if (x.GetType() != typeof(ModCategory))
					if (m_rolActiveMods.Contains((IMod)x))
						return true;

				return false;
			};

			// Setup AspectGetter (IconListView cell parser)
			SetupColumnParser();

			// Setup the Drag&Drop functionality
			SetupDragAndDrop();

			// Setup hyperlink manager
			SetupHyperlinkManager();

			// Setup ImageGetters
			SetupImageGetters();

			// Set control initialized
			this.Tag = true;
		}