Exemplo n.º 1
0
        // Token: 0x060002EA RID: 746 RVA: 0x0001231C File Offset: 0x0001051C
        private QueryFilter TranslatePropertyRestriction(Restriction.PropertyRestriction restriction)
        {
            object obj = this.ConvertValue(restriction.PropValue);

            if (restriction.PropTag.Id() == PropTag.Anr.Id())
            {
                return(new AmbiguousNameResolutionFilter((string)obj));
            }
            if (restriction.PropTag.Id() == PropTag.AddrType.Id())
            {
                return(new TrueFilter());
            }
            return(new ComparisonFilter(QueryFilterBuilder.ConvertRelOpToComparisonOperator(restriction.Op), QueryFilterBuilder.PropTagToPropertyDefinition(restriction.PropTag), obj));
        }
Exemplo n.º 2
0
        // 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");
        }