BeckhoffManager.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #endregion
  14. #region 内部变量
  15. BeckhoffCfg _cfg = null;
  16. #endregion
  17. #region 属性
  18. public BeckhoffCfg BeckhoffCfg
  19. {
  20. get { return _cfg; }
  21. set { _cfg = value; }
  22. }
  23. #endregion
  24. /// <summary>
  25. /// 初始化
  26. /// </summary>
  27. public void Initialize()
  28. {
  29. string xmlPath = "";
  30. xmlPath = Directory.GetParent(Directory.GetCurrentDirectory()).FullName + "\\net8.0-windows\\Config\\Beckhoffcfg.xml";
  31. BeckhoffModuleIOManager.Instance.Initialize(Directory.GetParent(Directory.GetCurrentDirectory()).FullName + "\\net8.0-windows\\Config\\ModuleIoCfg.xml");
  32. _cfg = CustomXmlSerializer.Deserialize<BeckhoffCfg>(new FileInfo(xmlPath));
  33. if (_cfg != null)
  34. {
  35. BeckhoffIOManager.Instance.Initialize(_cfg);
  36. }
  37. }
  38. }
  39. }