public Device(String name, XmlNode deviceNode, Protocol protocol) { this.name = name; foreach (XmlNode node in deviceNode.ChildNodes) { switch (node.Name) { case "options": foreach (XmlNode optNode in node.ChildNodes) { Option opt = Option.fromXml(optNode); options.Add(opt); } break; case "responds_when": responds_when = Rule.fromXml(node, protocol); break; case "transactions": foreach (XmlNode tNode in node.ChildNodes) { Transaction t = Transaction.fromXml(tNode, protocol); transactions.Add(t); } break; default: throw new NotSupportedException("Unknown node: " + node.Name); } } }
public RuleIsSet(XmlNode node, Protocol protocol) { if (node.Name == "isnset") reverse = true; else reverse = false; variable = node.Attributes["name"].Value; }
public static Rule fromXml(XmlNode node, Protocol protocol) { if (!ruleClasses.ContainsKey(node.Name)) throw new ArgumentException("Unknown rule " + node.Name); return (Rule)ruleClasses[ node.Name ].GetConstructor(new Type[] { typeof(XmlNode), typeof(Protocol) }) .Invoke(new object[] { node, protocol }); }
public RuleBlock(XmlNode node, Protocol protocol) { if (node.Name == "conditional") failSilently = true; foreach (XmlNode child in node.ChildNodes) { if(child.Name[0] != '#') rules.Add(Rule.fromXml(child, protocol)); } if (node.Attributes["name"] != null) name = node.Attributes["name"].Value; }
public RuleField(XmlNode node, Protocol p) { if (node.Attributes["name"] != null) name = node.Attributes["name"].Value; else name = ""; type = node.Attributes["type"].Value; if (node.Attributes["value"] != null) { value = Expression.fromString(node.Attributes["value"].Value); } }
public RuleMatch(XmlNode node, Protocol proto) { if (node.Attributes["name"] != null) { // <match name=... value=... /> Expression var = new VariableExpression("$" + node.Attributes["name"].Value); Expression value = Expression.fromString(node.Attributes["value"].Value); myExpr = new FunctionCallExpression("==", new List<Expression>(new Expression[] { var, value })); } else { // <match_expr>...</match_expr> myExpr = Expression.fromString(node.InnerText); } }
public RuleIncMsg(XmlNode node, Protocol proto) { p = proto; }
public void ProtocolConstructorTest() { protocol = new Protocol("..\\..\\..\\ProtoEngine\\Modbus-serial.xml"); }
public static Device fromXml(XmlNode deviceNode, Protocol protocol) { return new Device(deviceNode.Attributes["name"].Value, deviceNode, protocol); }
public static DevicePrototype fromXml(XmlNode node, Protocol protocol) { return new DevicePrototype(node, protocol); }
public DevicePrototype(XmlNode node, Protocol protocol) { device = Device.fromXml(node, protocol); }
public RuleSet(XmlNode node, Protocol proto) { name = node.Attributes["name"].Value; value = Expression.fromString(node.Attributes["value"].Value); }
public static Transaction fromXml(XmlNode node, Protocol protocol) { return new Transaction(node, protocol); }
public Transaction(XmlNode node, Protocol protocol) { rule = new RuleBlock(node, protocol); }