private GameManager() { if (!DBTypeMap.Instance.Initialized) { DBTypeMap.Instance.InitializeTypeMap(PackFileManagerSettingService.InstallationPath); } PackFileManagerSettingService.Load(); // correct game install directories // (should be needed for first start only) Game.Games.ForEach(g => LoadGameLocationFromFile(g)); CheckGameDirectories(); var gameEnum = PackFileManagerSettingService.CurrentSettings.CurrentGame; if (gameEnum != GameTypeEnum.Unknown) { CurrentGame = Game.GetByEnum(gameEnum); } foreach (Game game in Game.Games) { if (CurrentGame != null) { break; } if (game.IsInstalled) { CurrentGame = game; } } // no game installed? if (CurrentGame == null) { CurrentGame = DefaultGame; } #if DEBUG if (createdGameSchemata) { MessageBox.Show("Had to create game schema file"); } #endif }
// write game directories to gamedirs file static void SaveGameDirs() { foreach (var game in Game.Games) { var dir = game.GameDirectory == null ? Game.NOT_INSTALLED : game.GameDirectory; var currentEntry = PackFileManagerSettingService.CurrentSettings.GameDirectories.FirstOrDefault(x => x.Game == game.Id); if (currentEntry != null) { currentEntry.Path = dir; } else { PackFileManagerSettingService.CurrentSettings.GameDirectories.Add(new PackFileManagerSettings.GamePathPair() { Game = game.Id, Path = dir }); } } PackFileManagerSettingService.Save(); }