PKHeX.PKX.getCountryRegionText C# (CSharp) Method

getCountryRegionText() static private method

static private getCountryRegionText ( int country, int region, string lang ) : string[]
country int
region int
lang string
return string[]
        internal static string[] getCountryRegionText(int country, int region, string lang)
        {
            // Get Language we're fetching for
            int index = Array.IndexOf(new[] { "ja", "en", "fr", "de", "it", "es", "zh", "ko"}, lang);
            // Return value storage
            string[] data = new string[2]; // country, region

            // Get Country Text
            try
            {
                {
                    string[] inputCSV = Util.getSimpleStringList("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[index + 1];
                    }

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

            // Get Region Text
            try
            {
                {
                    string[] inputCSV = Util.getSimpleStringList("sr_" + country.ToString("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[index + 1];
                    }

                    int regionnum = Array.IndexOf(indexes, region);
                    data[1] = unsortedList[regionnum];
                }
            }
            catch { data[1] = "Illegal"; }
            return data;
        }
        internal static string getLocation(bool eggmet, int gameorigin, int locval)