Replacement for JDIS Importer
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

38 Zeilen
1.4 KiB

  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. namespace jdis_import
  8. {
  9. public class XMLData
  10. {
  11. private static Dictionary<string, string> _cclookup;
  12. public static Dictionary<string, string> CCLookup { get { return _cclookup; } set { _cclookup = value; } }
  13. private static Dictionary<string, int> _intervalLookup;
  14. public static Dictionary<string, int> IntervalLookup { get { return _intervalLookup; } set { _intervalLookup = value; } }
  15. public static void BuildIntervalLookup()
  16. {
  17. _intervalLookup = new Dictionary<string, int>();
  18. var doc = XDocument.Load(@"IntervalData.xml");
  19. var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
  20. Dictionary<string, string> dic = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
  21. foreach (KeyValuePair<string, string> kvp in dic)
  22. {
  23. _intervalLookup.Add(kvp.Key.Replace("ZZ", ""), int.Parse(kvp.Value));
  24. }
  25. }
  26. public static void BuildCCLookup()
  27. {
  28. _cclookup = new Dictionary<string, string>();
  29. var doc = XDocument.Load(string.Format("CCAddresses.xml"));
  30. var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
  31. _cclookup = rootNodes.ToDictionary(n => n.Name.ToString(), n => n.Value);
  32. }
  33. }
  34. }