/// <summary> /// Detect the language for the current installation /// </summary> /// <param name="gameDefinition"></param> /// <param name="rootDirectory"></param> /// <returns>language as string</returns> public static string ReadCurrentLanguage(IGameDefinition gameDefinition, FileSystem fileSystem) { if (PlatformUtility.IsWindowsPlatform()) { if (gameDefinition.LanguageRegistryKeys != null && gameDefinition.LanguageRegistryKeys.Any()) { if (ReadFromRegistry(gameDefinition.LanguageRegistryKeys, out var language)) { return(language); } } } switch (gameDefinition.Game) { case SageGame.CncGenerals: return(DetectFromFileSystem(fileSystem, "", "Audio", ".big")); case SageGame.CncGeneralsZeroHour: return(DetectFromFileSystem(fileSystem, "", "Audio", "ZH.big")); case SageGame.Bfme: case SageGame.Bfme2: case SageGame.Bfme2Rotwk: return(DetectFromFileSystem(fileSystem, "lang", "", "Audio.big")); case SageGame.Ra3Uprising: case SageGame.Ra3: return(DetectFromFileSystem(fileSystem, "Data", "", "Audio.big")); } return(DefaultLanguage); }
/// <summary> /// Detect the language for the current installation /// </summary> /// <param name="gameDefinition"></param> /// <param name="rootDirectory"></param> /// <returns>language as string</returns> public static string ReadCurrentLanguage(IGameDefinition gameDefinition, string rootDirectory) { if (PlatformUtility.IsWindowsPlatform()) { if (gameDefinition.LanguageRegistryKeys != null && gameDefinition.LanguageRegistryKeys.Any()) { return(ReadFromRegistry(gameDefinition.LanguageRegistryKeys)); } } switch (gameDefinition.Game) { case SageGame.CncGenerals: return(DetectFromFileSystem(rootDirectory, "Audio", ".big")); case SageGame.CncGeneralsZeroHour: return(DetectFromFileSystem(rootDirectory, "Audio", "ZH.big")); } return(DefaultLanguage); }