Searches for installed games.
Наследование: FileSearcher
		/// <summary>
		/// A simple constructor that initializes the object with the given dependencies.
		/// </summary>
		/// <param name="p_gmdGameModeInfo">The descriptor for the game modewhose install path is to be found.</param>
		/// <param name="p_gdtDetector">The discoverer to use to find the game installation path.</param>
		public GameModeSearchListViewItem(IGameModeDescriptor p_gmdGameModeInfo, GameDiscoverer p_gdtDetector)
			: base(p_gmdGameModeInfo)
		{
			Discoverer = p_gdtDetector;
			InitializeComponent();
			AutoSize = true;
			AutoSizeMode = AutoSizeMode.GrowAndShrink;
			SetVisiblePanel(pnlSearching);
			p_gdtDetector.PropertyChanged += new PropertyChangedEventHandler(Detector_PropertyChanged);
			p_gdtDetector.PathFound += new EventHandler<GameModeDiscoveredEventArgs>(Detector_PathFound);
			p_gdtDetector.TaskEnded += new EventHandler<TaskEndedEventArgs>(Detector_TaskEnded);

			lblGameModeName.Text = GameMode.Name;
			lblGameModeName.ForeColor = GameMode.ModeTheme.PrimaryColour;

			pbxGameLogo.Image = new Icon(GameMode.ModeTheme.Icon, 96, 96).ToBitmap();
		}
Пример #2
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_gdvGameDetector">The discoverer to use to find the game installation path.</param>
		/// <param name="p_gmrSupportedGameModes">The list of supported game modes.</param>
		public GameDetectionVM(IEnvironmentInfo p_eifEnvironmentInfo, GameDiscoverer p_gdvGameDetector, GameModeRegistry p_gmrSupportedGameModes)
		{
			EnvironmentInfo = p_eifEnvironmentInfo;
			GameDetector = p_gdvGameDetector;
			SupportedGameModes = p_gmrSupportedGameModes;
		}
Пример #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;
		}