Beispiel #1
0
        public ILocalization Build()
        {
            if (LocaleLoader == null)
            {
                throw new LocalizerException("There is no loader configured for this localisation.");
            }

            if (DefaultLocale != null && !LocaleLoader.Supports(DefaultLocale))
            {
                throw new LocalizerException($"The specified default locale \"{DefaultLocale}\" does not exist.");
            }

            return(new DefaultLocalization(LocaleLoader, ScriptOptions, DefaultLocale));
        }
Beispiel #2
0
        private IEnumerable <Locales> GetLocales(string modFolder)
        {
            string dowPath    = this.filePathProvider.SoulstormLocation;
            string localePath = Path.Combine(dowPath, modFolder, "Locale", "English");

            try
            {
                string[] files     = Directory.GetFiles(localePath, "*.ucs", SearchOption.AllDirectories);
                var      ucsLoader = new LocaleLoader();
                return(files.Select(x => ucsLoader.Load(x)));
            }
            catch (DirectoryNotFoundException)
            {
                return(Enumerable.Empty <Locales>());
            }
        }