|
1234567891011121314151617181920212223242526272829303132333435363738 |
- 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<string, string> _cclookup;
- public static Dictionary<string, string> CCLookup { get { return _cclookup; } set { _cclookup = value; } }
-
- private static Dictionary<string, int> _intervalLookup;
- public static Dictionary<string, int> IntervalLookup { get { return _intervalLookup; } set { _intervalLookup = value; } }
-
- public static void BuildIntervalLookup()
- {
- _intervalLookup = new Dictionary<string, int>();
- var doc = XDocument.Load(@"IntervalData.xml");
- var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
- Dictionary<string, string> dic = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
- foreach (KeyValuePair<string, string> kvp in dic)
- {
- _intervalLookup.Add(kvp.Key.Replace("ZZ", ""), int.Parse(kvp.Value));
- }
- }
-
- public static void BuildCCLookup()
- {
- _cclookup = new Dictionary<string, string>();
- var doc = XDocument.Load(string.Format("CCAddresses.xml"));
- var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
- _cclookup = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
- }
- }
- }
|