internal NotRestrictionData(Restriction.NotRestriction r) { base.ParseRestrictions(new Restriction[] { r.Restriction }); }
private Restriction FixRestriction(Restriction restriction) { if (restriction == null) { return(null); } switch (restriction.Type) { case Restriction.ResType.And: { Restriction.AndRestriction andRestriction = (Restriction.AndRestriction)restriction; andRestriction.Restrictions = this.FixRestrictions(andRestriction.Restrictions); break; } case Restriction.ResType.Or: { Restriction.OrRestriction orRestriction = (Restriction.OrRestriction)restriction; orRestriction.Restrictions = this.FixRestrictions(orRestriction.Restrictions); break; } case Restriction.ResType.Not: { Restriction.NotRestriction notRestriction = (Restriction.NotRestriction)restriction; notRestriction.Restriction = this.FixRestriction(notRestriction.Restriction); break; } case Restriction.ResType.Property: { Restriction.PropertyRestriction propertyRestriction = (Restriction.PropertyRestriction)restriction; propertyRestriction.PropValue = this.FixProperty(propertyRestriction.PropValue); break; } case Restriction.ResType.SubRestriction: { Restriction.SubRestriction subRestriction = (Restriction.SubRestriction)restriction; subRestriction.Restriction = this.FixRestriction(subRestriction.Restriction); break; } case Restriction.ResType.Comment: { Restriction.CommentRestriction commentRestriction = (Restriction.CommentRestriction)restriction; commentRestriction.Restriction = this.FixRestriction(commentRestriction.Restriction); break; } case Restriction.ResType.Count: { Restriction.CountRestriction countRestriction = (Restriction.CountRestriction)restriction; countRestriction.Restriction = this.FixRestriction(countRestriction.Restriction); break; } } return(restriction); }
private static bool EvaluateNotRestriction(Restriction.NotRestriction restriction, IRuleEvaluationContext context) { context.NestedLevel++; bool flag = !RestrictionEvaluator.Evaluate(restriction.Restriction, context); context.NestedLevel--; context.TraceFunction <bool>("NotRestriction evaluated to {0}", flag); return(flag); }
// Token: 0x060002E7 RID: 743 RVA: 0x00012144 File Offset: 0x00010344 private QueryFilter TranslateInternal(Restriction restriction, int depth) { if (restriction == null) { throw new NspiException(NspiStatus.TooComplex, "Null restriction"); } if (depth > 256) { throw new NspiException(NspiStatus.TooComplex, "Restriction is too deep"); } switch (restriction.Type) { case Restriction.ResType.And: case Restriction.ResType.Or: return(this.TranslateAndOrRestriction((Restriction.AndOrNotRestriction)restriction, depth + 1)); case Restriction.ResType.Not: { Restriction.NotRestriction notRestriction = (Restriction.NotRestriction)restriction; return(new NotFilter(this.TranslateInternal(notRestriction.Restriction, depth + 1))); } case Restriction.ResType.Content: return(this.TranslateContentRestriction((Restriction.ContentRestriction)restriction)); case Restriction.ResType.Property: return(this.TranslatePropertyRestriction((Restriction.PropertyRestriction)restriction)); case Restriction.ResType.Exist: { Restriction.ExistRestriction existRestriction = (Restriction.ExistRestriction)restriction; return(new ExistsFilter(QueryFilterBuilder.PropTagToPropertyDefinition(existRestriction.Tag))); } } throw new NspiException(NspiStatus.TooComplex, "Restriction.Type is not supported"); }
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"); }