1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using FestoDebugger.Service;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FestoDebugger.Beckoff
- {
- public class BeckhoffManager : Singleton<BeckhoffManager>
- {
- #region 内部常量
- private const string DI_ITEMLIST = "System.DIItemList";
- private const string DO_ITEMLIST = "System.DOItemList";
- private const string AI_ITEMLIST = "System.AIItemList";
- private const string AO_ITEMLIST = "System.AOItemList";
- private const string DIGITAL = "Digital";
- private const string ANALOG = "Analog";
- #endregion
- #region 内部变量
- BeckhoffCfg _cfg = null;
- #endregion
- #region 属性
- public BeckhoffCfg BeckhoffCfg
- {
- get { return _cfg; }
- set { _cfg = value; }
- }
- #endregion
- /// <summary>
- /// 初始化
- /// </summary>
- public void Initialize()
- {
- string xmlPath = "";
-
- xmlPath = Directory.GetParent(Directory.GetCurrentDirectory()).FullName + "Config\\Beckhoffcfg.xml";
-
- BeckhoffModuleIOManager.Instance.Initialize(Directory.GetParent(Directory.GetCurrentDirectory()).FullName + "Config\\ModuleIoCfg.xml");
- _cfg = CustomXmlSerializer.Deserialize<BeckhoffCfg>(new FileInfo(xmlPath));
- if (_cfg != null)
- {
- BeckhoffIOManager.Instance.Initialize(_cfg);
- }
- }
- }
- }
|