The view displaying the progress of the search for installed games.
Inheritance: Nexus.Client.UI.ManagedFontForm
コード例 #1
0
        /// <summary>
        /// Gets a registry of installed game modes.
        /// </summary>
        /// <param name="supportedGameModes">The games modes supported by the mod manager.</param>
        /// <returns>A registry of installed game modes.</returns>
        protected GameModeRegistry GetInstalledGameModes(GameModeRegistry supportedGameModes)
        {
            if (!_environmentInfo.Settings.InstalledGamesDetected)
            {
                var gdrGameDetector  = new GameDiscoverer();
                var vmlGameDetection = new GameDetectionVM(_environmentInfo, gdrGameDetector, supportedGameModes);
                var frmGameDetector  = new GameDetectionForm(vmlGameDetection);

                gdrGameDetector.Find(supportedGameModes.RegisteredGameModeFactories);
                frmGameDetector.ShowDialog();

                if (gdrGameDetector.Status != TaskStatus.Complete)
                {
                    return(null);
                }

                if (gdrGameDetector.DiscoveredGameModes.Count == 0)
                {
                    return(null);
                }

                _environmentInfo.Settings.InstalledGames.Clear();
                var j = 0;

                foreach (var gidGameMode in gdrGameDetector.DiscoveredGameModes)
                {
                    if (gidGameMode?.GameMode != null)
                    {
                        var gmfGameModeFactory = supportedGameModes.GetGameMode(gidGameMode.GameMode.ModeId);
                        _environmentInfo.Settings.InstallationPaths[gidGameMode.GameMode.ModeId] = gmfGameModeFactory.GetInstallationPath(gidGameMode.GameInstallPath);
                        _environmentInfo.Settings.ExecutablePaths[gidGameMode.GameMode.ModeId]   = gmfGameModeFactory.GetExecutablePath(gidGameMode.GameInstallPath);
                        _environmentInfo.Settings.InstalledGames.Add(gidGameMode.GameMode.ModeId);
                    }
                    else
                    {
                        MessageBox.Show($"An error occured during the scan of the game {gdrGameDetector.DiscoveredGameModes[j].GameMode.ModeId} : {Environment.NewLine + "The object GameMode is NULL"}");
                    }

                    j++;
                }

                _environmentInfo.Settings.InstalledGamesDetected = true;
                _environmentInfo.Settings.CacheOverhaulSetup     = false;
                _environmentInfo.Settings.Save();
            }

            var gmrInstalledGameModes = GameModeRegistry.LoadInstalledGameModes(supportedGameModes, _environmentInfo);

            return(gmrInstalledGameModes);
        }
コード例 #2
0
        /// <summary>
        /// Gets a registry of installed game modes.
        /// </summary>
        /// <param name="p_gmrSupportedGameModes">The games modes supported by the mod manager.</param>
        /// <returns>A registry of installed game modes.</returns>
        protected GameModeRegistry GetInstalledGameModes(GameModeRegistry p_gmrSupportedGameModes)
        {
            if (!m_eifEnvironmentInfo.Settings.InstalledGamesDetected)
            {
                GameDiscoverer    gdrGameDetector  = new GameDiscoverer();
                GameDetectionVM   vmlGameDetection = new GameDetectionVM(m_eifEnvironmentInfo, gdrGameDetector, p_gmrSupportedGameModes);
                GameDetectionForm frmGameDetector  = new GameDetectionForm(vmlGameDetection);
                gdrGameDetector.Find(p_gmrSupportedGameModes.RegisteredGameModeFactories);
                frmGameDetector.ShowDialog();
                if (gdrGameDetector.Status != TaskStatus.Complete)
                {
                    return(null);
                }
                if (gdrGameDetector.DiscoveredGameModes.Count == 0)
                {
                    return(null);
                }
                m_eifEnvironmentInfo.Settings.InstalledGames.Clear();
                Int32 j = 0;
                foreach (GameDiscoverer.GameInstallData gidGameMode in gdrGameDetector.DiscoveredGameModes)
                {
                    if ((gidGameMode != null) && (gidGameMode.GameMode != null))
                    {
                        IGameModeFactory gmfGameModeFactory = p_gmrSupportedGameModes.GetGameMode(gidGameMode.GameMode.ModeId);
                        m_eifEnvironmentInfo.Settings.InstallationPaths[gidGameMode.GameMode.ModeId] = gmfGameModeFactory.GetInstallationPath(gidGameMode.GameInstallPath);
                        m_eifEnvironmentInfo.Settings.ExecutablePaths[gidGameMode.GameMode.ModeId]   = gmfGameModeFactory.GetExecutablePath(gidGameMode.GameInstallPath);
                        m_eifEnvironmentInfo.Settings.InstalledGames.Add(gidGameMode.GameMode.ModeId);
                    }
                    else
                    {
                        MessageBox.Show(string.Format("An error occured during the scan of the game {0} : {1}", gdrGameDetector.DiscoveredGameModes[j].GameMode.ModeId, Environment.NewLine + "The object GameMode is NULL"));
                    }
                    j++;
                }
                m_eifEnvironmentInfo.Settings.InstalledGamesDetected = true;
                m_eifEnvironmentInfo.Settings.CacheOverhaulSetup     = false;
                m_eifEnvironmentInfo.Settings.Save();
            }
            GameModeRegistry gmrInstalledGameModes = GameModeRegistry.LoadInstalledGameModes(p_gmrSupportedGameModes, m_eifEnvironmentInfo);

            return(gmrInstalledGameModes);
        }
コード例 #3
0
		/// <summary>
		/// Gets a registry of installed game modes.
		/// </summary>
		/// <param name="p_gmrSupportedGameModes">The games modes supported by the mod manager.</param>
		/// <returns>A registry of installed game modes.</returns>
		protected GameModeRegistry GetInstalledGameModes(GameModeRegistry p_gmrSupportedGameModes)
		{
			if (!m_eifEnvironmentInfo.Settings.InstalledGamesDetected)
			{
				GameDiscoverer gdrGameDetector = new GameDiscoverer();
				GameDetectionVM vmlGameDetection = new GameDetectionVM(m_eifEnvironmentInfo, gdrGameDetector, p_gmrSupportedGameModes);
				GameDetectionForm frmGameDetector = new GameDetectionForm(vmlGameDetection);
				gdrGameDetector.Find(p_gmrSupportedGameModes.RegisteredGameModeFactories);
				frmGameDetector.ShowDialog();
				if (gdrGameDetector.Status != TaskStatus.Complete)
					return null;
				if (gdrGameDetector.DiscoveredGameModes.Count == 0)
					return null;
				m_eifEnvironmentInfo.Settings.InstalledGames.Clear();
				Int32 j = 0;
				foreach (GameDiscoverer.GameInstallData gidGameMode in gdrGameDetector.DiscoveredGameModes)
				{
					if ((gidGameMode != null) && (gidGameMode.GameMode != null))
					{
						IGameModeFactory gmfGameModeFactory = p_gmrSupportedGameModes.GetGameMode(gidGameMode.GameMode.ModeId);
						m_eifEnvironmentInfo.Settings.InstallationPaths[gidGameMode.GameMode.ModeId] = gmfGameModeFactory.GetInstallationPath(gidGameMode.GameInstallPath);
						m_eifEnvironmentInfo.Settings.ExecutablePaths[gidGameMode.GameMode.ModeId] = gmfGameModeFactory.GetExecutablePath(gidGameMode.GameInstallPath);
						m_eifEnvironmentInfo.Settings.InstalledGames.Add(gidGameMode.GameMode.ModeId);
					}
					else
					{
						MessageBox.Show(string.Format("An error occured during the scan of the game {0} : {1}", gdrGameDetector.DiscoveredGameModes[j].GameMode.ModeId, Environment.NewLine + "The object GameMode is NULL"));
					}
					j++;
				}
				m_eifEnvironmentInfo.Settings.InstalledGamesDetected = true;
				m_eifEnvironmentInfo.Settings.Save();
			}
			GameModeRegistry gmrInstalledGameModes = GameModeRegistry.LoadInstalledGameModes(p_gmrSupportedGameModes, m_eifEnvironmentInfo);
			return gmrInstalledGameModes;
		}