public Settings(string fileName) { XmlDocument xml = new XmlDocument(); try { xml.Load(fileName); } catch { return; } XmlNode rootNode = xml.SelectSingleNode("root/SystemParams"); foreach (XmlNode node in rootNode.ChildNodes) { if (node.Name == "Param") { settings.Add( new Setting() { Key = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "Key"), Value = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "Value"), }); } } }
public static TIRAPTagT20Object CreateInstance(XmlNode node) { if (node.Name != "Row") { return(null); } TIRAPTagT20Object rlt = new TIRAPTagT20Object() { Ordinal = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "Ordinal"), 0), T20LeafID = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "T20LeafID"), 0), ParameterName = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "ParameterName"), LowLimit = Tools.ConvertToInt64(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "LowLimit"), 0), Criterion = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "Criterion"), HighLimit = Tools.ConvertToInt64(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "HighLimit"), 0), Scale = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "Scale"), 0), UnitOfMeasure = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "UnitOfMeasure"), RecordingMode = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "RecordingMode"), 0), SamplingCycle = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "SamplingCycle"), 0), RTDBDSLinkID = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "RTDBDSLinkID"), 0), RTDBTagName = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "RTDBTagName"), Reference = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "Reference"), 0), StartPosition = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "StartPosition"), 0), EndPosition = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "EndPosition"), 0), }; return(rlt); }
public ESBConfigurationParam(string fileName) { XmlDocument xml = new XmlDocument(); try { xml.Load(fileName); } catch (Exception) { return; } XmlNode parentNode = xml.SelectSingleNode("root/ESBParams"); foreach (XmlNode childNode in parentNode.ChildNodes) { if (childNode.Name == "ESBParam") { BrokeUri = IRAPXMLUtils.GetXMLNodeAttributeValue(childNode, "BrokeUri"); QueueName = IRAPXMLUtils.GetXMLNodeAttributeValue(childNode, "QueueName"); Filter = IRAPXMLUtils.GetXMLNodeAttributeValue(childNode, "Filter"); ExCode = IRAPXMLUtils.GetXMLNodeAttributeValue(childNode, "ExCode"); break; } } }
/// <summary> /// 根据 XMLNode 创建 TIRAPOPCTag 实例 /// </summary> /// <param name="node"></param> /// <returns></returns> public static TIRAPOPCTag CreateInstance(XmlNode node) { if (node.Name != "Tag") { return(null); } TIRAPOPCTag rlt = new TIRAPOPCTag(); rlt.TagLeafID = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "TagLeafID")); rlt.TagName = IRAPXMLUtils.GetXMLNodeAttributeValue(node, "TagName"); rlt.TagType = Tools.ConvertToInt32(IRAPXMLUtils.GetXMLNodeAttributeValue(node, "TagType")); rlt.TestItems.Clear(); foreach (XmlNode child in node.ChildNodes) { TIRAPTagT20Object item = TIRAPTagT20Object.CreateInstance(child); if (item != null) { rlt.TestItems.Add(item); } } return(rlt); }
public WebAPIParam(string fileName) { XmlDocument xml = new XmlDocument(); try { xml.Load(fileName); } catch (Exception) { return; } XmlNode parentNode = xml.SelectSingleNode("root/WebAPI"); if (parentNode != null) { BrokeUri = IRAPXMLUtils.GetXMLNodeAttributeValue(parentNode, "BrokeUri"); ContentType = IRAPXMLUtils.GetXMLNodeAttributeValue(parentNode, "ContentType"); ClientID = IRAPXMLUtils.GetXMLNodeAttributeValue(parentNode, "ClientID"); } }