18 private static readonly SortedDictionary<string, string> countryByCode =
new SortedDictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
19 private static readonly SortedDictionary<string, string> codeByCountry =
new SortedDictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
21 internal static void Load()
29 foreach (XmlNode N
in Doc.DocumentElement.ChildNodes)
31 if (N is XmlElement E && E.LocalName ==
"Entry")
36 if (!
string.IsNullOrEmpty(Code) && !
string.IsNullOrEmpty(Country))
38 countryByCode[Code] = Country;
39 codeByCountry[Country] = Code;
58 string[] Result =
new string[countryByCode.Count];
59 countryByCode.Keys.CopyTo(Result, 0);
71 string[] Result =
new string[codeByCountry.Count];
72 codeByCountry.Keys.CopyTo(Result, 0);
83 Dictionary<string, IElement> Result =
new Dictionary<string, IElement>();
85 foreach (KeyValuePair<string, string> P
in countryByCode)
100 return countryByCode.TryGetValue(Code, out Country);
110 public static bool TryGetCode(
string Country, out
string Code)
112 return codeByCountry.TryGetValue(Country, out Code);
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
static XmlDocument LoadFromFile(string FileName)
Loads an XML document from a file.
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Static class managing the runtime environment of the IoT Gateway.
static string AppDataFolder
Application data folder.
Data in accordance with ISO 3166
static string[] Countries
Registered ISO-3166-1 Country Names
static string[] Codes
Registered ISO-3166-1 Country Codes
static bool TryGetCode(string Country, out string Code)
Tries to get the ISO 3166-1 Country Code from a Country Name. String comparisons are case-insensitive...
static bool TryGetCountry(string Code, out string Country)
Tries to get the Country Name from a ISO 3166-1 Country Code. String comparisons are case-insensitive...
static Dictionary< string, IElement > GetEntries()
All entries, with Country Codes as keys, and Country Names as values.