/// <summary>
/// Loads the factories for games that have been previously detected as installed.
/// </summary>
/// <param name="supportedGameModes">A registry containing the factories for all supported game modes.</param>
/// <param name="environmentInfo">The application's environment info.</param>
/// <returns>A registry containing all of the game mode factories for games that were previously detected as installed.</returns>
public static GameModeRegistry LoadInstalledGameModes(GameModeRegistry supportedGameModes, EnvironmentInfo environmentInfo)
{
Trace.TraceInformation("Loading Game Mode Factories for Installed Games...");
Trace.Indent();
var installedGameModes = new GameModeRegistry();
foreach (var gameId in environmentInfo.Settings.InstalledGames)
{
Trace.Write($"Loading {gameId}: ");
if (supportedGameModes.IsRegistered(gameId))
{
Trace.WriteLine("Supported");
installedGameModes.RegisterGameMode(supportedGameModes.GetGameMode(gameId));
}
else
{
Trace.WriteLine("Not Supported");
}
}
Trace.Unindent();
return(installedGameModes);
}