From 8e95070398b0e3c05f7bd870c71ad1dd00dcc14e Mon Sep 17 00:00:00 2001 From: hanqiangqiang <1364346467@qq.com> Date: Thu, 18 May 2023 19:07:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=8A=A0=E5=85=A5=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HardwareUnits/ValueMfc/NameValue.cs | 15 ++++ .../ValueMfc/ValueMfcInputOutRow.cs | 14 ++++ .../HardwareUnits/ValueMfc/ValueMfcState.cs | 79 +++++++++++++++++++ .../MECF.Framework.RT.EquipmentLibrary.csproj | 3 + 4 files changed, 111 insertions(+) create mode 100644 MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/NameValue.cs create mode 100644 MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcInputOutRow.cs create mode 100644 MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcState.cs diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/NameValue.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/NameValue.cs new file mode 100644 index 0000000..f961b8f --- /dev/null +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/NameValue.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.ValueMfc +{ + public class NameValue + { + public string Name { get; set; } + public string Value { get; set; } + public string ControlName { get; set; } + } +} diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcInputOutRow.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcInputOutRow.cs new file mode 100644 index 0000000..4abf55f --- /dev/null +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcInputOutRow.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.ValueMfc +{ + public class ValueMfcInputOutRow + { + public List InputList { get; set; } = new List(); + public List OutList { get; set; } = new List(); + } +} diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcState.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcState.cs new file mode 100644 index 0000000..87669ae --- /dev/null +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/ValueMfc/ValueMfcState.cs @@ -0,0 +1,79 @@ +using Aitex.Core.RT.Device; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.ValueMfc +{ + public class ValueMfcState : BaseDevice + { + List InputOutList = new List(); + public void ReadXML(string fileName) + { + try + { + XmlDocument xml = new XmlDocument();//初始化一个xml实例 + xml.Load(fileName); + XmlElement root = xml.DocumentElement; + XmlNodeList nodelist = root.ChildNodes; + //遍历输出. + + foreach (XmlNode node in nodelist) + { + ValueMfcInputOutRow inputOutRow = new ValueMfcInputOutRow(); + var nodeBlocks = node.SelectNodes("Condition/Inputs/Input"); + if (nodeBlocks != null) + { + foreach (var nodeBlock in nodeBlocks) + { + if (!(nodeBlock is XmlElement xmlBlock)) + { + continue; + } + NameValue keyValue = new NameValue() + { + Name = xmlBlock.GetAttribute("Name"), + Value = xmlBlock.GetAttribute("Value"), + ControlName = xmlBlock.GetAttribute("ControlName") + }; + inputOutRow.InputList.Add(keyValue); + } + } + nodeBlocks = node.SelectNodes("Condition/Outputs/Output"); + if (nodeBlocks != null) + { + foreach (var nodeBlock in nodeBlocks) + { + if (!(nodeBlock is XmlElement xmlBlock)) + { + continue; + } + NameValue keyValue = new NameValue() + { + Name = xmlBlock.GetAttribute("Name"), + Value = xmlBlock.GetAttribute("Value"), + ControlName = xmlBlock.GetAttribute("ControlName") + }; + inputOutRow.OutList.Add(keyValue); + } + } + InputOutList.Add(inputOutRow); + } + } + catch (Exception ex) + { + + throw; + } + + } + protected override void HandleMonitor() + { + + } + + } +} diff --git a/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj b/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj index fa43e19..dd2762f 100644 --- a/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj +++ b/MECF.Framework.RT.EquipmentLibrary/MECF.Framework.RT.EquipmentLibrary.csproj @@ -335,6 +335,9 @@ + + +