예제 #1
0
        public static ICondition ReadComplexCondition(XmlReader reader)
        {
            Properties properties = Properties.ReadFromAttributes(reader);

            reader.Read();
            ICondition condition = null;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    switch (reader.LocalName)
                    {
                    case "And":
                        condition = AndCondition.Read(reader);
                        goto exit;

                    case "Or":
                        condition = OrCondition.Read(reader);
                        goto exit;

                    case "Not":
                        condition = NegatedCondition.Read(reader);
                        goto exit;

                    default:
                        throw new AddInLoadException("Invalid element name '" + reader.LocalName
                                                     + "', the first entry in a ComplexCondition " +
                                                     "must be <And>, <Or> or <Not>");
                    }
                }
            }
exit:
            if (condition != null)
            {
                ConditionFailedAction action = properties.Get("action", ConditionFailedAction.Exclude);
                condition.Action = action;
            }
            return(condition);
        }
예제 #2
0
 public static T Get <T>(string property, T defaultValue)
 {
     return(properties.Get(property, defaultValue));
 }
예제 #3
0
 public Condition(string name, Properties properties)
 {
     this.name       = name;
     this.properties = properties;
     action          = properties.Get("action", ConditionFailedAction.Exclude);
 }