Esempio n. 1
0
        /// <summary>
        /// Gets the Country string for a given Country ID
        /// </summary>
        /// <param name="country">Country ID</param>
        /// <param name="language">Language ID</param>
        /// <returns>Country ID string</returns>
        private static string GetCountryString(int country, int language)
        {
            string c;

            // Get Country Text
            try
            {
                string[] inputCSV = Util.GetStringList("countries");
                // Set up our Temporary Storage
                string[] unsortedList = new string[inputCSV.Length - 1];
                int[]    indexes      = new int[inputCSV.Length - 1];

                // Gather our data from the input file
                for (int i = 1; i < inputCSV.Length; i++)
                {
                    string[] countryData = inputCSV[i].Split(',');
                    if (countryData.Length <= 1)
                    {
                        continue;
                    }
                    indexes[i - 1]      = Convert.ToInt32(countryData[0]);
                    unsortedList[i - 1] = countryData[language + 1];
                }

                int countrynum = Array.IndexOf(indexes, country);
                c = unsortedList[countrynum];
            }
            catch { c = "Illegal"; }

            return(c);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the Region string for a specified country ID.
        /// </summary>
        /// <param name="country">Country ID</param>
        /// <param name="region">Region ID</param>
        /// <param name="language">Language ID</param>
        /// <returns>Region ID string</returns>
        private static string GetRegionString(int country, int region, int language)
        {
            // Get Region Text
            try
            {
                string[] inputCSV = Util.GetStringList($"sr_{country:000}");
                // Set up our Temporary Storage
                string[] unsortedList = new string[inputCSV.Length - 1];
                int[]    indexes      = new int[inputCSV.Length - 1];

                // Gather our data from the input file
                for (int i = 1; i < inputCSV.Length; i++)
                {
                    string[] countryData = inputCSV[i].Split(',');
                    if (countryData.Length <= 1)
                    {
                        continue;
                    }
                    indexes[i - 1]      = Convert.ToInt32(countryData[0]);
                    unsortedList[i - 1] = countryData[language + 1];
                }

                int regionnum = Array.IndexOf(indexes, region);
                return(unsortedList[regionnum]);
            }
            catch { return("Illegal"); }
        }
Esempio n. 3
0
        public static string[] GetStrings(string ident, string lang, string type = "text")
        {
            string[] data = Util.GetStringList(ident, lang, type);
            if (data.Length == 0)
            {
                data = Util.GetStringList(ident, DefaultLanguage, type);
            }

            return(data);
        }
Esempio n. 4
0
            private string[] Get(string ident)
            {
                string[] data = Util.GetStringList(ident, lang);
                if (data == null || data.Length == 0)
                {
                    data = Util.GetStringList(ident, DefaultLanguage);
                }

                return(data);
            }
Esempio n. 5
0
        private static string[][] GetRegionList(int country)
        {
            var input = Util.GetStringList($"sr_{country:000}");

            return(UnpackList(input));
        }
Esempio n. 6
0
        private static string[][] GetCountryList()
        {
            var input = Util.GetStringList("countries");

            return(UnpackList(input));
        }
Esempio n. 7
0
        public GameStrings(string l)
        {
            lang    = l;
            ribbons = Get("ribbons");
            // Past Generation strings
            g3items = Get("ItemsG3");
            // XD and Colosseum
            {
                g3coloitems = (string[])g3items.Clone();
                string[] tmp = Get("ItemsG3Colosseum");
                Array.Resize(ref g3coloitems, 500 + tmp.Length);
                for (int i = g3items.Length; i < g3coloitems.Length; i++)
                {
                    g3coloitems[i] = $"UNUSED {i}";
                }
                tmp.CopyTo(g3coloitems, g3coloitems.Length - tmp.Length);

                g3xditems = (string[])g3items.Clone();
                string[] tmp2 = Get("ItemsG3XD");
                Array.Resize(ref g3xditems, 500 + tmp2.Length);
                for (int i = g3items.Length; i < g3xditems.Length; i++)
                {
                    g3xditems[i] = $"UNUSED {i}";
                }
                tmp2.CopyTo(g3xditems, g3xditems.Length - tmp2.Length);
            }
            g2items          = Get("ItemsG2");
            g1items          = Get("ItemsG1");
            metRSEFRLG_00000 = Get("rsefrlg_00000");
            metGSC_00000     = Get("gsc_00000");

            metCXD_00000 = Get("cxd_00000");
            // Sanitize a little
            var metSanitize = (string[])metCXD_00000.Clone();

            for (int i = 0; i < metSanitize.Length; i++)
            {
                if (metCXD_00000.Count(r => r == metSanitize[i]) > 1)
                {
                    metSanitize[i] += $" [{i:000}]";
                }
            }
            metCXD_00000 = metSanitize;

            // Current Generation strings
            natures     = Util.GetNaturesList(l);
            types       = Get("types");
            abilitylist = Get("abilities");

            movelist = Get("moves");
            string[] ps = { "P", "S" }; // Distinguish Physical/Special
            for (int i = 622; i < 658; i++)
            {
                movelist[i] += $" ({ps[i % 2]})";
            }

            itemlist          = Get("items");
            characteristics   = Get("character");
            specieslist       = Get("species");
            wallpapernames    = Get("wallpaper");
            encountertypelist = Get("encountertype");
            gamelist          = Get("games");
            gamelanguages     = Util.GetNulledStringArray(Util.GetStringList("languages"));

            balllist = new string[Legal.Items_Ball.Length];
            for (int i = 0; i < balllist.Length; i++)
            {
                balllist[i] = itemlist[Legal.Items_Ball[i]];
            }

            pokeblocks    = Get("pokeblock");
            forms         = Get("forms");
            memories      = Get("memories");
            genloc        = Get("genloc");
            trainingbags  = Get("trainingbag");
            trainingstage = Get("supertraining");
            puffs         = Get("puff");
            Array.Resize(ref puffs, puffs.Length + 1);
            Array.Copy(puffs, 0, puffs, 1, puffs.Length - 1);

            eggname       = specieslist[0];
            metHGSS_00000 = Get("hgss_00000");
            metHGSS_02000 = Get("hgss_02000");
            metHGSS_03000 = Get("hgss_03000");
            metBW2_00000  = Get("bw2_00000");
            metBW2_30000  = Get("bw2_30000");
            metBW2_40000  = Get("bw2_40000");
            metBW2_60000  = Get("bw2_60000");
            metXY_00000   = Get("xy_00000");
            metXY_30000   = Get("xy_30000");
            metXY_40000   = Get("xy_40000");
            metXY_60000   = Get("xy_60000");
            metSM_00000   = Get("sm_00000");
            metSM_30000   = Get("sm_30000");
            metSM_40000   = Get("sm_40000");
            metSM_60000   = Get("sm_60000");

            Sanitize();

            g4items = (string[])itemlist.Clone();
            Get("mail4").CopyTo(g4items, 137);

            InitializeDataSources();
        }
Esempio n. 8
0
        /// <summary>
        /// Applies localization to a static class containing language-specific strings.
        /// </summary>
        /// <param name="t">Type of the static class containing the desired strings.</param>
        /// <param name="languageFilePrefix">Prefix of the language file to use.  Example: if the target is legality_en.txt, <paramref name="languageFilePrefix"/> should be "legality".</param>
        /// <param name="currentCultureCode">Culture information</param>
        private static void SetLocalization(Type t, string languageFilePrefix, string currentCultureCode)
        {
            var lines = Util.GetStringList($"{languageFilePrefix}_{currentCultureCode}");

            SetLocalization(t, lines);
        }