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\r\nML\r\nMM\r\nMN\r\nMO|zh-Hant\r\nMP\r\nMQ\r\nMR\r\nMS\r\nMT\r\nMU\r\nMV\r\nMW\r\nMX|es-MX\r\nMY|ms\r\nMZ\r\nNA\r\nNC\r\nNE\r\nNF\r\nNG\r\nNI|es\r\nNL|nl\r\nNO|nb\r\nNP\r\nNR\r\nNU\r\nNZ\r\nOM|ar\r\nPA|es\r\nPE|es\r\nPF\r\nPG\r\nPH\r\nPK\r\nPL|pl\r\nPM\r\nPN\r\nPR|es\r\nPS\r\nPT|pt\r\nPW\r\nPY|es\r\nQA|ar\r\nRE\r\nRO|ro\r\nRS\r\nRU|ru\r\nRW\r\nSA|ar\r\nSB\r\nSC\r\nSD\r\nSE|sv\r\nSG|zh-Hant\r\nSH\r\nSI\r\nSJ\r\nSK|sk\r\nSL\r\nSM\r\nSN\r\nSO\r\nSR\r\nSS\r\nST\r\nSV|es\r\nSX\r\nSY|ar\r\nSZ\r\nTC\r\nTD\r\nTF\r\nTG\r\nTH|th\r\nTJ\r\nTK\r\nTL\r\nTM\r\nTN|ar\r\nTO\r\nTR|tr\r\nTT\r\nTV\r\nTW|zh-Hant\r\nTZ\r\nUA|uk\r\nUG\r\nUM\r\nUS|en\r\nUY|es\r\nUZ\r\nVA\r\nVC\r\nVE|es\r\nVG\r\nVI\r\nVN|vi\r\nVU\r\nWF\r\nWS\r\nYE|ar\r\nYT\r\nZA|ar\r\nZM\r\nZW"; string[] separator = new string[1] { "\r\n" }; int num = 0; foreach (string str2 in str1.Split(separator, (StringSplitOptions)num)) { try { string[] strArray = str2.Split(new string[1] { "|" }, StringSplitOptions.None); RegionInfo regionInfo = new RegionInfo(strArray[0]); countrycodeiOS countrycodeiOs = new countrycodeiOS() { countrycode = strArray[0], countryname = regionInfo.EnglishName }; countrycodeiOs.languageCode = ((IEnumerable <string>)strArray).Count <string>() == 1 ? "en" : strArray[1]; countrycodeiOs.currency = regionInfo.ISOCurrencySymbol; this.listcountrycodeiOS.Add(countrycodeiOs); } catch (Exception ex) { } } }
public static string getCountryNameFromCountryCode(string ctCode) { List <countrycodeiOS> countryList = RunData.getInstance().listCountryCodeiOS; countrycodeiOS result = countryList.Find(x => x.countrycode.Equals(ctCode)); if (result != null) { return(result.countryname); } else { return(""); } }
public void setCountryByIP(string IP) { ipData ipData = this.getIPData(IP); if (ipData == null) { return; } this.timezone = ipData.timezone; countrycodeiOS infoByCountryCode = this.getCountryInfoByCountryCode(ipData.countryCode); this.country = infoByCountryCode.countryname; this.countryCode = infoByCountryCode.countrycode; this.currency = infoByCountryCode.currency; this.language = infoByCountryCode.languageCode; double num1 = (double)iDevice.GetRandomNumber(-10000, 10000) / 100000.0; double num2 = (double)iDevice.GetRandomNumber(-10000, 10000) / 100000.0; this.latude = ipData.lat + num1; this.longtude = ipData.lon + num2; }
private void loadcountrycodeiOS() { string rawData = Resources.countrycodeiOS; string[] array = rawData.Split(new string[] { "\r\n" }, StringSplitOptions.None); foreach (string text in array) { try { string[] lineComponent = text.Split(new string[] { "|" }, StringSplitOptions.None); RegionInfo regionInfo = new RegionInfo(lineComponent[0]); countrycodeiOS countrycodeiOS2 = new countrycodeiOS(); countrycodeiOS2.countrycode = lineComponent[0]; countrycodeiOS2.countryname = regionInfo.EnglishName; if (lineComponent.Count <string>() == 1) { countrycodeiOS2.languageCode = "en"; } else { countrycodeiOS2.languageCode = lineComponent[1]; } this.listCountryCodeiOS.Add(countrycodeiOS2); this.regioninfolist.Add(regionInfo); } catch (Exception) { } } }