|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml.Linq;
- using System.Threading.Tasks;
- using System.IO;
-
- 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>();
- string intervalLookupPath = Path.Combine(Program.ExeDir, "IntervalData.xml");
- var doc = XDocument.Load(intervalLookupPath);
- 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()
- {
- string ccLookupPath = Path.Combine(Program.ExeDir, "CCAddresses.xml");
- _cclookup = new Dictionary<string, string>();
- var doc = XDocument.Load(ccLookupPath);
- var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
- _cclookup = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
- }
- }
- }
|