using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; using System.Threading.Tasks; namespace jdis_import { public class XMLData { private static Dictionary _cclookup; public static Dictionary CCLookup { get { return _cclookup; } set { _cclookup = value; } } private static Dictionary _intervalLookup; public static Dictionary IntervalLookup { get { return _intervalLookup; } set { _intervalLookup = value; } } public static void BuildIntervalLookup() { _intervalLookup = new Dictionary(); var doc = XDocument.Load(@"IntervalData.xml"); var rootNodes = doc.Root.DescendantNodes().OfType(); Dictionary dic = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value); foreach (KeyValuePair kvp in dic) { _intervalLookup.Add(kvp.Key.Replace("ZZ", ""), int.Parse(kvp.Value)); } } public static void BuildCCLookup() { _cclookup = new Dictionary(); var doc = XDocument.Load(string.Format("CCAddresses.xml")); var rootNodes = doc.Root.DescendantNodes().OfType(); _cclookup = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value); } } }