BeckhoffManager.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using FestoDebugger.Service;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace FestoDebugger.Beckoff
  9. {
  10. public class BeckhoffManager : Singleton<BeckhoffManager>
  11. {
  12. #region 内部常量
  13. private const string DI_ITEMLIST = "System.DIItemList";
  14. private const string DO_ITEMLIST = "System.DOItemList";
  15. private const string AI_ITEMLIST = "System.AIItemList";
  16. private const string AO_ITEMLIST = "System.AOItemList";
  17. private const string DIGITAL = "Digital";
  18. private const string ANALOG = "Analog";
  19. #endregion
  20. #region 内部变量
  21. BeckhoffCfg _cfg = null;
  22. #endregion
  23. #region 属性
  24. public BeckhoffCfg BeckhoffCfg
  25. {
  26. get { return _cfg; }
  27. set { _cfg = value; }
  28. }
  29. #endregion
  30. /// <summary>
  31. /// 初始化
  32. /// </summary>
  33. public void Initialize()
  34. {
  35. string xmlPath = "";
  36. xmlPath = Directory.GetParent(Directory.GetCurrentDirectory()).FullName + "Config\\Beckhoffcfg.xml";
  37. BeckhoffModuleIOManager.Instance.Initialize(Directory.GetParent(Directory.GetCurrentDirectory()).FullName + "Config\\ModuleIoCfg.xml");
  38. _cfg = CustomXmlSerializer.Deserialize<BeckhoffCfg>(new FileInfo(xmlPath));
  39. if (_cfg != null)
  40. {
  41. BeckhoffIOManager.Instance.Initialize(_cfg);
  42. }
  43. }
  44. }
  45. }