Ejemplo n.º 1
0
        public static TerminalTriggerSet LoadFromXml(XmlElement parent)
        {
            var sets     = new TerminalTriggerSet();
            var nodeList = parent.GetElementsByTagName("triggerSet");

            if (nodeList == null || nodeList.Count == 0)
            {
                return(sets);
            }
            var node = (XmlElement)nodeList[0];

            if (node.Attributes["formula"] != null)
            {
                sets.Formula = node.Attributes["formula"].Value;
            }

            foreach (XmlElement child in node.ChildNodes)
            {
                var trigger = TerminalScriptTrigger.LoadFromXml(child);
                if (trigger != null)
                {
                    sets.triggers.Add(trigger);
                }
            }

            return(sets);
        }
Ejemplo n.º 2
0
 protected virtual TerminalScript LoadScriptFromXml(XmlElement node)
 {
     try
     {
         PropertyXMLTagAttribute.InitObjectProperties(this, node);
         var triggers = node.GetElementsByTagName("trigger");
         if (triggers.Count > 0)
         {
             Trigger = TerminalScriptTrigger.LoadFromXml((XmlElement)triggers[0]);
         }
     }
     catch (Exception ex)
     {
         Logger.ErrorFormat("Error while LoadScriptFromXml() for \"{0}\": {1}",
                            ScriptName, ex);
         return(null);
     }
     return(this);
 }