Exemple #1
0
        protected override void SaveRuleSubElements(XmlWriter writer, Rule rule)
        {
            base.SaveRuleSubElements(writer, rule);
            OutlookProtectionRule outlookProtectionRule = (OutlookProtectionRule)rule;

            if (outlookProtectionRule.UserOverridable)
            {
                writer.WriteStartElement("userOverridable");
                writer.WriteEndElement();
            }
        }
        protected override void CreateRuleSubElements(Rule rule, XmlReader reader, RulesCreationContext creationContext)
        {
            OutlookProtectionRule outlookProtectionRule = (OutlookProtectionRule)rule;

            if (base.IsTag(reader, "userOverridable"))
            {
                outlookProtectionRule.UserOverridable = true;
                base.ReadNext(reader);
                return;
            }
            outlookProtectionRule.UserOverridable = false;
        }
        private static PredicateCondition FindPredicateConditionByName(Condition root, string name)
        {
            if (root == null)
            {
                return(null);
            }
            ConditionType conditionType = root.ConditionType;

            if (conditionType != ConditionType.And)
            {
                switch (conditionType)
                {
                case ConditionType.True:
                    return(null);

                case ConditionType.Predicate:
                {
                    PredicateCondition predicateCondition = (PredicateCondition)root;
                    if (string.Equals(predicateCondition.Name, name, StringComparison.Ordinal))
                    {
                        return(predicateCondition);
                    }
                    return(null);
                }
                }
                return(null);
            }
            AndCondition andCondition = (AndCondition)root;

            foreach (Condition root2 in andCondition.SubConditions)
            {
                PredicateCondition predicateCondition2 = OutlookProtectionRule.FindPredicateConditionByName(root2, name);
                if (predicateCondition2 != null)
                {
                    return(predicateCondition2);
                }
            }
            return(null);
        }
 private Action FindActionByName(string name)
 {
     return(OutlookProtectionRule.FindActionByName(base.Actions, name));
 }
 private PredicateCondition FindPredicateConditionByName(string name)
 {
     return(OutlookProtectionRule.FindPredicateConditionByName(base.Condition, name));
 }