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 Device(Device dev) { name = dev.name; transactions = dev.transactions; options = new List<Option>(); foreach (Option o in dev.options) options.Add(o.copy()); responds_when = dev.responds_when; }
public Transaction(XmlNode node, Protocol protocol) { rule = new RuleBlock(node, protocol); }