示例#1
0
 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);
         }
     }
 }
示例#2
0
 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;
 }
示例#3
0
 public Transaction(XmlNode node, Protocol protocol)
 {
     rule = new RuleBlock(node, protocol);
 }