Exemplo n.º 1
0
        public override void LoadXml(XmlElement e)
        {
            base.LoadXml(e);
            if (Enum.TryParse <CombineRule>(e.GetAttribute("rule"), out CombineRule rule))
            {
                Rule = rule;
            }
            Not = bool.TryParse(e.GetAttribute("not"), out bool not) && not;
            XmlNodeList nl = e.GetElementsByTagName("subrule");

            foreach (XmlNode node in nl)
            {
                XmlElement el      = (XmlElement)node;
                Type       type    = Type.GetType(el.GetAttribute("type"));
                UseRule    subRule = (UseRule)Activator.CreateInstance(type);
                subRule.LoadXml(el);
                Rules.Add(subRule);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Combines the specified rule to this combined rule set.
 /// </summary>
 /// <param name="rule">The rule to combine with this rule set.</param>
 /// <returns>This instance of CombinedUseRule (so you can chain Combine calls).</returns>
 public CombinedUseRule Combine(UseRule rule)
 {
     Rules.Add(rule);
     return(this);
 }