初步加入解析功能
This commit is contained in:
parent
2c6eec3137
commit
8e95070398
|
@ -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; }
|
||||
}
|
||||
}
|
|
@ -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<NameValue> InputList { get; set; } = new List<NameValue>();
|
||||
public List<NameValue> OutList { get; set; } = new List<NameValue>();
|
||||
}
|
||||
}
|
|
@ -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<ValueMfcInputOutRow> InputOutList = new List<ValueMfcInputOutRow>();
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -335,6 +335,9 @@
|
|||
<Compile Include="HardwareUnits\UPS\ITAUPSConnection.cs" />
|
||||
<Compile Include="HardwareUnits\Vacuometer\Vacuometer.cs" />
|
||||
<Compile Include="HardwareUnits\Vacuometer\VacuometerConnection.cs" />
|
||||
<Compile Include="HardwareUnits\ValueMfc\ValueMfcInputOutRow.cs" />
|
||||
<Compile Include="HardwareUnits\ValueMfc\NameValue.cs" />
|
||||
<Compile Include="HardwareUnits\ValueMfc\ValueMfcState.cs" />
|
||||
<Compile Include="HardwareUnits\VCE\BrooksVCE\BrooksVCE.cs" />
|
||||
<Compile Include="HardwareUnits\VCE\BrooksVCE\BrooksVCEConnection.cs" />
|
||||
<Compile Include="HardwareUnits\VCE\BrooksVCE\BrooksVCEHandler.cs" />
|
||||
|
|
Loading…
Reference in New Issue