Replacement for JDIS Importer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Xml.Linq;
  6. using System.Threading.Tasks;
  7. using System.IO;
  8. namespace jdis_import
  9. {
  10. public class XMLData
  11. {
  12. private static Dictionary<string, string> _cclookup;
  13. public static Dictionary<string, string> CCLookup { get { return _cclookup; } set { _cclookup = value; } }
  14. private static Dictionary<string, int> _intervalLookup;
  15. public static Dictionary<string, int> IntervalLookup { get { return _intervalLookup; } set { _intervalLookup = value; } }
  16. public static void BuildIntervalLookup()
  17. {
  18. _intervalLookup = new Dictionary<string, int>();
  19. string intervalLookupPath = Path.Combine(Program.ExeDir, "IntervalData.xml");
  20. var doc = XDocument.Load(intervalLookupPath);
  21. var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
  22. Dictionary<string, string> dic = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
  23. foreach (KeyValuePair<string, string> kvp in dic)
  24. {
  25. _intervalLookup.Add(kvp.Key.Replace("ZZ", ""), int.Parse(kvp.Value));
  26. }
  27. }
  28. public static void BuildCCLookup()
  29. {
  30. string ccLookupPath = Path.Combine(Program.ExeDir, "CCAddresses.xml");
  31. _cclookup = new Dictionary<string, string>();
  32. var doc = XDocument.Load(ccLookupPath);
  33. var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
  34. _cclookup = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
  35. }
  36. }
  37. }