Gives back the and result of two conditions.
Inheritance: ICondition
Exemple #1
0
        public static ICondition[] ReadConditionList(XmlReader reader, string endElement, AddIn addIn)
        {
            List <ICondition> conditions = new List <ICondition>();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.EndElement:
                    if (reader.LocalName == endElement)
                    {
                        return(conditions.ToArray());
                    }
                    break;

                case XmlNodeType.Element:
                    switch (reader.LocalName)
                    {
                    case "And":
                        conditions.Add(AndCondition.Read(reader, addIn));
                        break;

                    case "Or":
                        conditions.Add(OrCondition.Read(reader, addIn));
                        break;

                    case "Not":
                        conditions.Add(NegatedCondition.Read(reader, addIn));
                        break;

                    case "Condition":
                        conditions.Add(Condition.Read(reader, addIn));
                        break;

                    default:
                        throw new AddInLoadException("Invalid element name '" + reader.LocalName
                                                     + "', entries in a <" + endElement + "> " +
                                                     "must be <And>, <Or>, <Not> or <Condition>");
                    }
                    break;
                }
            }
            return(conditions.ToArray());
        }
Exemple #2
0
        public static ICondition ReadComplexCondition(XmlReader reader, AddIn addIn)
        {
            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, addIn);
                        goto exit;

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

                    case "Not":
                        condition = NegatedCondition.Read(reader, addIn);
                        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);
        }
Exemple #3
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;

                    case "Condition":
                        condition = Condition.Read(reader);
                        goto exit;
                    }
                    break;
                }
            }
exit:
            if (condition != null)
            {
                ConditionFailedAction action = properties.Get("action", ConditionFailedAction.Exclude);
                condition.Action = action;
            }
            return(condition);
        }
Exemple #4
0
        public static ICondition[] ReadConditionList(XmlReader reader, string endElement)
        {
            List <ICondition> conditions = new List <ICondition>();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.EndElement:
                    if (reader.LocalName == endElement)
                    {
                        return(conditions.ToArray());
                    }
                    break;

                case XmlNodeType.Element:
                    switch (reader.LocalName)
                    {
                    case "And":
                        conditions.Add(AndCondition.Read(reader));
                        break;

                    case "Or":
                        conditions.Add(OrCondition.Read(reader));
                        break;

                    case "Not":
                        conditions.Add(NegatedCondition.Read(reader));
                        break;

                    case "Condition":
                        conditions.Add(Condition.Read(reader));
                        break;
                    }
                    break;
                }
            }
            return(conditions.ToArray());
        }