This class encapsulates the data and the operations presented by UI elements that display the progress of game detection.
Пример #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);
        }
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_vmlGameDetection">The game detector view model.</param>
		public GameDetectionForm(GameDetectionVM p_vmlGameDetection)
		{
			InitializeComponent();
			this.lblInfo.Text = string.Format("NMM needs to know what games you have installed on your system in order to continue.\nPlease use the green 'tick' symbols next to each game to confirm their install paths.\nPress the 'Stop searching' button if you'd like to manually specify your game folders.\nPress the 'Quick startup' button if you want to proceed with just the games you've already verified.\nPlease note: NMM is only searching for installed games that the program supports and is not gathering or transmitting this data to any external service or site.");
			ViewModel = p_vmlGameDetection;
		}
Пример #4
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;
		}
Пример #5
0
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_vmlGameDetection">The game detector view model.</param>
 public GameDetectionForm(GameDetectionVM p_vmlGameDetection)
 {
     InitializeComponent();
     this.lblInfo.Text = string.Format("NMM needs to know what games you have installed on your system in order to continue.\nPlease use the green 'tick' symbols next to each game to confirm their install paths.\nPress the 'Stop searching' button if you'd like to manually specify your game folders.\nPress the 'Quick startup' button if you want to proceed with just the games you've already verified.\nPlease note: NMM is only searching for installed games that the program supports and is not gathering or transmitting this data to any external service or site.");
     ViewModel         = p_vmlGameDetection;
 }