internal static Restriction BuildIsReadRestriction(SinglePropertyFilter filter, IFilterBuilderHelper mapper)
        {
            ContentFilterSchema.ContentFilterPropertyDefinition contentFilterPropertyDefinition = (ContentFilterSchema.ContentFilterPropertyDefinition)filter.Property;
            PropTag propTagToSearch = contentFilterPropertyDefinition.PropTagToSearch;
            bool    flag;

            ContentFilterBuilder.CheckFilterIsEQorNE(filter, out flag);
            bool flag2 = (bool)ContentFilterBuilder.GetPropertyValue(filter);

            if (flag)
            {
                flag2 = !flag2;
            }
            if (!flag2)
            {
                return(Restriction.BitMaskZero(propTagToSearch, 1));
            }
            return(Restriction.BitMaskNonZero(propTagToSearch, 1));
        }
        private static Restriction BuildRestriction(QueryFilter filter, IFilterBuilderHelper helper)
        {
            CompositeFilter compositeFilter = filter as CompositeFilter;

            if (compositeFilter != null)
            {
                Restriction[] array = new Restriction[compositeFilter.FilterCount];
                int           num   = 0;
                foreach (QueryFilter filter2 in compositeFilter.Filters)
                {
                    array[num++] = ContentFilterBuilder.BuildRestriction(filter2, helper);
                }
                if (compositeFilter is AndFilter)
                {
                    return(Restriction.And(array));
                }
                if (compositeFilter is OrFilter)
                {
                    return(Restriction.Or(array));
                }
                throw ContentFilterBuilder.UnexpectedFilterType(filter);
            }
            else
            {
                NotFilter notFilter = filter as NotFilter;
                if (notFilter != null)
                {
                    return(Restriction.Not(ContentFilterBuilder.BuildRestriction(notFilter.Filter, helper)));
                }
                SinglePropertyFilter singlePropertyFilter = filter as SinglePropertyFilter;
                if (singlePropertyFilter == null)
                {
                    throw ContentFilterBuilder.UnexpectedFilterType(filter);
                }
                ContentFilterSchema.ContentFilterPropertyDefinition contentFilterPropertyDefinition = singlePropertyFilter.Property as ContentFilterSchema.ContentFilterPropertyDefinition;
                if (contentFilterPropertyDefinition == null)
                {
                    throw ContentFilterBuilder.UnexpectedFilterType(filter);
                }
                return(contentFilterPropertyDefinition.ConvertToRestriction(singlePropertyFilter, helper));
            }
        }
 private static Restriction BuildRestrictionWrapper(SinglePropertyFilter filter, PropTag ptagToSearch, IFilterBuilderHelper mapper, ContentFilterBuilder.BuildRestrictionDelegate restrictionBuilder)
 {
     ContentFilterSchema.ContentFilterPropertyDefinition contentFilterPropertyDefinition = (ContentFilterSchema.ContentFilterPropertyDefinition)filter.Property;
     if (ptagToSearch == PropTag.Null)
     {
         if (contentFilterPropertyDefinition.NamedPropToSearch != null)
         {
             ptagToSearch = mapper.MapNamedProperty(contentFilterPropertyDefinition.NamedPropToSearch, contentFilterPropertyDefinition.NamedPropType);
         }
         else
         {
             ptagToSearch = contentFilterPropertyDefinition.PropTagToSearch;
         }
     }
     if (filter is ExistsFilter)
     {
         return(Restriction.Exist(ptagToSearch));
     }
     return(restrictionBuilder(filter, mapper, ptagToSearch));
 }
        internal static Restriction BuildIsFlaggedRestriction(SinglePropertyFilter filter, IFilterBuilderHelper mapper)
        {
            ContentFilterSchema.ContentFilterPropertyDefinition contentFilterPropertyDefinition = (ContentFilterSchema.ContentFilterPropertyDefinition)filter.Property;
            PropTag propTagToSearch = contentFilterPropertyDefinition.PropTagToSearch;
            bool    flag;

            ContentFilterBuilder.CheckFilterIsEQorNE(filter, out flag);
            bool flag2 = (bool)ContentFilterBuilder.GetPropertyValue(filter);

            if (flag)
            {
                flag2 = !flag2;
            }
            Restriction restriction = Restriction.EQ(propTagToSearch, 2);

            if (!flag2)
            {
                return(Restriction.Not(restriction));
            }
            return(restriction);
        }