Exemple #1
0
        bool HasLanguageFiles(GameLanguage language)
        {
            var config = Resolve <IAssetManager>().LoadGeneralConfig();
            var path   = Path.Combine(config.BasePath, config.XldPath, language.ToString().ToUpper());

            return(Directory.Exists(path));
        }
Exemple #2
0
        public static string GetLanguage(GameLanguage lan)
        {
            var            name  = lan.ToString();
            SystemLanguage s_lan = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), name);

            return(GetLanguage(s_lan));
        }
Exemple #3
0
        /// <exception cref="FileNotFoundException" />
        public static string GetLanguageFilePath(Project targetProject, GameLanguage language)
        {
            string languageFilePath = string.Empty;

            // Find the language file in the project's /Script/ folder
            foreach (string file in Directory.GetFiles(targetProject.ScriptPath, "*.txt", SearchOption.TopDirectoryOnly))
            {
                if (Path.GetFileNameWithoutExtension(file).ToLower() == language.ToString().ToLower())
                {
                    languageFilePath = file;
                    break;
                }
            }

            if (string.IsNullOrEmpty(languageFilePath))
            {
                throw new FileNotFoundException("Couldn't find the " + language.ToString().ToUpper() + ".TXT file.");
            }

            return(languageFilePath);
        }
Exemple #4
0
        bool HasLanguageFiles(GameLanguage language)
        {
            var config = Resolve <IGeneralConfig>();

            foreach (var searchPath in config.SearchPaths)
            {
                var path = config.ResolvePath($"{searchPath}/{language.ToString().ToUpperInvariant()}");
                if (Directory.Exists(path))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #5
0
        public ModApplier()
        {
            AttachChild(_assetCache);
            On <SetLanguageEvent>(e =>
            {
                if (_language == e.Language)
                {
                    return;
                }

                _language  = e.Language;
                var config = Resolve <IGeneralConfig>();
                config.SetPath("LANG", _language.ToString().ToUpperInvariant());
                Raise(new ReloadAssetsEvent());
                Raise(new LanguageChangedEvent());
            });
        }