Example #1
0
        public override bool CompareSingleValue(PropTag tag, Restriction.RelOp op, object messageValue, object ruleValue)
        {
            bool flag = base.CompareSingleValue(tag, op, messageValue, ruleValue);

            if (flag || tag != PropTag.SenderSearchKey)
            {
                return(flag);
            }
            return(base.CompareAddresses(messageValue, ruleValue));
        }
Example #2
0
        public override bool CompareSingleValue(PropTag tag, Restriction.RelOp op, object messageValue, object ruleValue)
        {
            bool flag = base.CompareSingleValue(tag, op, messageValue, ruleValue);

            if (flag || tag != PropTag.SearchKey)
            {
                base.TraceDebug <bool>("PFRecipientContext.CompareSingleValue returning {0}.", flag);
                return(flag);
            }
            return(base.CompareAddresses(messageValue, ruleValue));
        }
Example #3
0
 internal static bool GetOperationResultFromOrder(Restriction.RelOp op, int order)
 {
     if (order < 0)
     {
         return(op == Restriction.RelOp.LessThan || op == Restriction.RelOp.LessThanOrEqual || op == Restriction.RelOp.NotEqual);
     }
     if (order == 0)
     {
         return(op == Restriction.RelOp.GreaterThanOrEqual || op == Restriction.RelOp.LessThanOrEqual || op == Restriction.RelOp.Equal);
     }
     return(op == Restriction.RelOp.GreaterThanOrEqual || op == Restriction.RelOp.GreaterThan || op == Restriction.RelOp.NotEqual);
 }
 public virtual bool CompareSingleValue(PropTag tag, Restriction.RelOp op, object x, object y)
 {
     if (x == null)
     {
         return(y == null);
     }
     if (y == null)
     {
         return(false);
     }
     if (!RestrictionEvaluator.IsSupportedOperation(op))
     {
         throw new InvalidRuleException(string.Format("Operation {0} is not supported", op));
     }
     if (x.GetType() != y.GetType() && (!(x.GetType() == typeof(ExDateTime)) || !(y.GetType() == typeof(DateTime))))
     {
         throw new InvalidRuleException(string.Format("Can not compare values of type {0} and type {1}", x.GetType(), y.GetType()));
     }
     if (op == Restriction.RelOp.MemberOfDL)
     {
         byte[] array = x as byte[];
         if (array == null)
         {
             this.TraceDebug("CompareSingleValue: MemberOf, recipientEntryId is not a byte array.");
             this.RecordError(ServerStrings.FolderRuleErrorInvalidRecipientEntryId);
             return(false);
         }
         byte[] array2 = y as byte[];
         if (array2 == null)
         {
             this.TraceDebug("CompareSingleValue: MemberOf, groupEntryId is not a byte array, marking rule in error.");
             throw new InvalidRuleException(ServerStrings.FolderRuleErrorInvalidGroup(y.GetType().Name));
         }
         return(RuleUtil.IsMemberOf(this, array, array2));
     }
     else
     {
         int?num = RestrictionEvaluator.CompareValue(this.CultureInfo, tag, x, y);
         if (num == null)
         {
             throw new InvalidRuleException(string.Format("Can't compare value '{0}' and '{1}'", x, y));
         }
         return(RestrictionEvaluator.GetOperationResultFromOrder(op, num.Value));
     }
 }
Example #5
0
        // Token: 0x060002E4 RID: 740 RVA: 0x00012048 File Offset: 0x00010248
        private static ComparisonOperator ConvertRelOpToComparisonOperator(Restriction.RelOp relOp)
        {
            switch (relOp)
            {
            case Restriction.RelOp.LessThan:
                return(ComparisonOperator.LessThan);

            case Restriction.RelOp.LessThanOrEqual:
                return(ComparisonOperator.LessThanOrEqual);

            case Restriction.RelOp.GreaterThan:
                return(ComparisonOperator.GreaterThan);

            case Restriction.RelOp.GreaterThanOrEqual:
                return(ComparisonOperator.GreaterThanOrEqual);

            case Restriction.RelOp.Equal:
                return(ComparisonOperator.Equal);

            case Restriction.RelOp.NotEqual:
                return(ComparisonOperator.NotEqual);

            case Restriction.RelOp.RegularExpression:
                break;

            default:
                switch (relOp)
                {
                case Restriction.RelOp.Include:
                case Restriction.RelOp.Exclude:
                    break;

                default:
                    if (relOp != Restriction.RelOp.MemberOfDL)
                    {
                    }
                    break;
                }
                break;
            }
            throw new NspiException(NspiStatus.TooComplex, "Restriction.RelOp is not supported");
        }
Example #6
0
        private static bool CompareValueWithMultiValue(IRuleEvaluationContext context, PropTag tag, Restriction.RelOp op, object messageValue, object ruleValueObject)
        {
            Array array = (Array)ruleValueObject;
            bool  flag  = false;

            foreach (object y in array)
            {
                flag = context.CompareSingleValue(tag, Restriction.RelOp.Equal, messageValue, y);
                if (flag)
                {
                    break;
                }
            }
            if (op == Restriction.RelOp.NotEqual)
            {
                flag = !flag;
            }
            return(flag);
        }
Example #7
0
        private static bool CompareMultiValueWithValue(IRuleEvaluationContext context, PropTag tag, Restriction.RelOp op, object messageValueObject, object ruleValue)
        {
            Array array = (Array)messageValueObject;
            bool  flag  = false;

            foreach (object x in array)
            {
                flag = context.CompareSingleValue(tag, op, x, ruleValue);
                if (flag)
                {
                    if (op != Restriction.RelOp.NotEqual)
                    {
                        break;
                    }
                }
                else if (op == Restriction.RelOp.NotEqual)
                {
                    break;
                }
            }
            return(flag);
        }
Example #8
0
 internal static bool IsSupportedOperation(Restriction.RelOp op)
 {
     return(RestrictionEvaluator.IsOrderOperation(op) || op == Restriction.RelOp.MemberOfDL);
 }
Example #9
0
 internal static bool IsOrderOperation(Restriction.RelOp op)
 {
     return(op == Restriction.RelOp.Equal || op == Restriction.RelOp.NotEqual || op == Restriction.RelOp.LessThan || op == Restriction.RelOp.LessThanOrEqual || op == Restriction.RelOp.GreaterThan || op == Restriction.RelOp.GreaterThanOrEqual);
 }
Example #10
0
 internal static RelationOperator ConvertFromMapiRelOp(Restriction.RelOp relOp)
 {
     return((RelationOperator)relOp);
 }
        internal Restriction ReadRestriction()
        {
            OutlookBlobWriter.RestrictionType restrictionType = (OutlookBlobWriter.RestrictionType) this.ReadInt();
            switch (restrictionType)
            {
            case OutlookBlobWriter.RestrictionType.And:
            case OutlookBlobWriter.RestrictionType.Or:
            {
                int           num   = this.ReadInt();
                Restriction[] array = new Restriction[num];
                for (int i = 0; i < num; i++)
                {
                    array[i] = this.ReadRestriction();
                }
                if (restrictionType == OutlookBlobWriter.RestrictionType.And)
                {
                    return(Restriction.And(array));
                }
                return(Restriction.Or(array));
            }

            case OutlookBlobWriter.RestrictionType.Not:
                return(Restriction.Not(this.ReadRestriction()));

            case OutlookBlobWriter.RestrictionType.Content:
            {
                ContentFlags flags = (ContentFlags)this.ReadInt();
                PropTag      tag   = (PropTag)this.ReadInt();
                return(Restriction.Content(tag, this.ReadPropValue().Value, flags));
            }

            case OutlookBlobWriter.RestrictionType.Property:
            {
                Restriction.RelOp relOp = (Restriction.RelOp) this.ReadInt();
                PropTag           tag2  = (PropTag)this.ReadInt();
                return(new Restriction.PropertyRestriction(relOp, tag2, this.ReadPropValue().Value));
            }

            case OutlookBlobWriter.RestrictionType.PropertyComparison:
            {
                Restriction.RelOp relOp2   = (Restriction.RelOp) this.ReadInt();
                PropTag           tagLeft  = (PropTag)this.ReadInt();
                PropTag           tagRight = (PropTag)this.ReadInt();
                return(new Restriction.ComparePropertyRestriction(relOp2, tagLeft, tagRight));
            }

            case OutlookBlobWriter.RestrictionType.Bitmask:
                if (this.ReadInt() == 0)
                {
                    return(Restriction.BitMaskZero((PropTag)this.ReadInt(), this.ReadInt()));
                }
                return(Restriction.BitMaskNonZero((PropTag)this.ReadInt(), this.ReadInt()));

            case OutlookBlobWriter.RestrictionType.Size:
            {
                Restriction.RelOp relop = (Restriction.RelOp) this.ReadInt();
                PropTag           tag3  = (PropTag)this.ReadInt();
                int size = this.ReadInt();
                return(new Restriction.SizeRestriction(relop, tag3, size));
            }

            case OutlookBlobWriter.RestrictionType.Exist:
            {
                PropTag tag4 = (PropTag)this.ReadInt();
                return(Restriction.Exist(tag4));
            }

            case OutlookBlobWriter.RestrictionType.Subfilter:
            {
                PropTag propTag = (PropTag)this.ReadInt();
                if (propTag == PropTag.MessageAttachments || propTag == PropTag.MessageRecipients)
                {
                    return(Restriction.Sub(propTag, this.ReadRestriction()));
                }
                throw new CorruptDataException(ServerStrings.ExUnknownRestrictionType);
            }

            default:
                throw new CorruptDataException(ServerStrings.ExUnknownRestrictionType);
            }
        }
Example #12
0
 protected static Restriction CreateDateTimePropertyRestriction(PropTag propertyTag, ExDateTime dateTime, Restriction.RelOp relop)
 {
     return(new Restriction.PropertyRestriction(relop, propertyTag, (DateTime)dateTime.ToUtc()));
 }
Example #13
0
 protected static Restriction CreateBooleanPropertyRestriction(PropTag propertyTag, bool value, Restriction.RelOp relop)
 {
     return(new Restriction.PropertyRestriction(relop, propertyTag, value));
 }
Example #14
0
 protected static Restriction CreateIntPropertyRestriction(PropTag propertyTag, int value, Restriction.RelOp relop)
 {
     return(new Restriction.PropertyRestriction(relop, propertyTag, value));
 }