コード例 #1
0
 internal RecipientRestrictionData(Restriction.RecipientRestriction r)
 {
     base.ParseRestrictions(new Restriction[]
     {
         r.Restriction
     });
 }
コード例 #2
0
        private static bool EvaluateRecipientRestriction(Restriction.RecipientRestriction restriction, IRuleEvaluationContext context)
        {
            context.TraceFunction("RecipientRestriction");
            context.NestedLevel++;
            bool flag = false;

            foreach (Recipient recipient in context.Message.Recipients)
            {
                using (IRuleEvaluationContext recipientContext = context.GetRecipientContext(recipient))
                {
                    context.TraceFunction <string>("Recipient {0}", recipient.Participant.DisplayName);
                    if (RestrictionEvaluator.Evaluate(restriction.Restriction, recipientContext))
                    {
                        flag = true;
                        break;
                    }
                }
            }
            context.NestedLevel--;
            context.TraceFunction <bool>("RecipientRestriction evaluates to {0}", flag);
            return(flag);
        }
コード例 #3
0
 internal void WriteRestriction(Restriction restriction)
 {
     if (restriction is Restriction.BitMaskRestriction)
     {
         Restriction.BitMaskRestriction bitMaskRestriction = (Restriction.BitMaskRestriction)restriction;
         this.WriteInt(6);
         this.WriteInt((int)bitMaskRestriction.Bmr);
         this.WriteInt((int)bitMaskRestriction.Tag);
         this.WriteInt(bitMaskRestriction.Mask);
         return;
     }
     if (restriction is Restriction.AndRestriction)
     {
         this.WriteInt(0);
         Restriction.AndRestriction andRestriction = (Restriction.AndRestriction)restriction;
         this.WriteInt(andRestriction.Restrictions.Length);
         foreach (Restriction restriction2 in andRestriction.Restrictions)
         {
             this.WriteRestriction(restriction2);
         }
         return;
     }
     if (restriction is Restriction.OrRestriction)
     {
         this.WriteInt(1);
         Restriction.OrRestriction orRestriction = (Restriction.OrRestriction)restriction;
         this.WriteInt(orRestriction.Restrictions.Length);
         foreach (Restriction restriction3 in orRestriction.Restrictions)
         {
             this.WriteRestriction(restriction3);
         }
         return;
     }
     if (restriction is Restriction.NotRestriction)
     {
         Restriction.NotRestriction notRestriction = (Restriction.NotRestriction)restriction;
         this.WriteInt(2);
         this.WriteRestriction(notRestriction.Restriction);
         return;
     }
     if (restriction is Restriction.ContentRestriction)
     {
         Restriction.ContentRestriction contentRestriction = (Restriction.ContentRestriction)restriction;
         this.WriteInt(3);
         this.WriteInt((int)contentRestriction.Flags);
         this.WriteInt((int)contentRestriction.PropTag);
         this.WritePropValue(contentRestriction.PropValue.PropTag, contentRestriction.PropValue.Value);
         return;
     }
     if (restriction is Restriction.PropertyRestriction)
     {
         Restriction.PropertyRestriction propertyRestriction = (Restriction.PropertyRestriction)restriction;
         this.WriteInt(4);
         this.WriteInt((int)propertyRestriction.Op);
         this.WriteInt((int)propertyRestriction.PropTag);
         this.WritePropValue(propertyRestriction.PropValue.PropTag, propertyRestriction.PropValue.Value);
         return;
     }
     if (restriction is Restriction.ComparePropertyRestriction)
     {
         Restriction.ComparePropertyRestriction comparePropertyRestriction = (Restriction.ComparePropertyRestriction)restriction;
         this.WriteInt(5);
         this.WriteInt((int)comparePropertyRestriction.Op);
         this.WriteInt((int)comparePropertyRestriction.TagLeft);
         this.WriteInt((int)comparePropertyRestriction.TagRight);
         return;
     }
     if (restriction is Restriction.ExistRestriction)
     {
         Restriction.ExistRestriction existRestriction = (Restriction.ExistRestriction)restriction;
         this.WriteInt(8);
         this.WriteInt((int)existRestriction.Tag);
         return;
     }
     if (restriction is Restriction.AttachmentRestriction)
     {
         Restriction.AttachmentRestriction attachmentRestriction = (Restriction.AttachmentRestriction)restriction;
         this.WriteInt(9);
         this.WriteInt(236126221);
         this.WriteRestriction(attachmentRestriction.Restriction);
         return;
     }
     if (restriction is Restriction.RecipientRestriction)
     {
         Restriction.RecipientRestriction recipientRestriction = (Restriction.RecipientRestriction)restriction;
         this.WriteInt(9);
         this.WriteInt(236060685);
         this.WriteRestriction(recipientRestriction.Restriction);
         return;
     }
     throw new ArgumentException(ServerStrings.ExUnknownRestrictionType, "restriction");
 }