Example #1
0
        internal static void CheckValueType(object value, PropTag tag)
        {
            if (value == null)
            {
                return;
            }
            PropType propType = tag.ValueType();

            Type[] array = RuleUtil.singleValuePropTypes;
            if (tag.IsMultiValued() || tag.IsMultiInstance())
            {
                array = RuleUtil.multiValuePropTypes;
            }
            uint num = (uint)(propType & (PropType)(-12289));

            if (num < (uint)array.Length)
            {
                Type type = array[(int)((UIntPtr)num)];
                if (type != null)
                {
                    if (value.GetType() == type)
                    {
                        return;
                    }
                    if (value.GetType() == typeof(ExDateTime) && type == typeof(DateTime))
                    {
                        return;
                    }
                    throw new InvalidRuleException(string.Format("Value of tag {0} is of unexpected type {1}", tag, value.GetType()));
                }
            }
            throw new InvalidRuleException(string.Format("Can't determine type for tag {0}", tag));
        }
        // Token: 0x060012C4 RID: 4804 RVA: 0x0006D934 File Offset: 0x0006BB34
        private static void SkipProperty(PropTag propTag, byte[] recordBuffer, ref int propertyOffset)
        {
            int i   = 1;
            int num = 0;

            if (propTag.IsMultiValued())
            {
                DiffFileGenerator.GetV4IntegerValue(recordBuffer, ref propertyOffset, out i);
            }
            while (i > 0)
            {
                PropType propType = propTag.ValueType() & (PropType)(-4097);
                if (propType <= PropType.Boolean)
                {
                    if (propType != PropType.Int && propType != PropType.Boolean)
                    {
                        goto IL_69;
                    }
                    DiffFileGenerator.GetV4IntegerValue(recordBuffer, ref propertyOffset, out num);
                }
                else
                {
                    switch (propType)
                    {
                    case PropType.AnsiString:
                    case PropType.String:
                        while (recordBuffer[propertyOffset++] != 0)
                        {
                        }
                        break;

                    default:
                        if (propType != PropType.Binary)
                        {
                            goto IL_69;
                        }
                        goto IL_69;
                    }
                }
IL_78:
                i--;
                continue;
IL_69:
                DiffFileGenerator.GetV4IntegerValue(recordBuffer, ref propertyOffset, out num);
                propertyOffset += num;
                goto IL_78;
            }
        }
        private static Restriction BuildComparisonRestriction(ComparisonFilter filter, PropTag ptagToSearch, object propValue)
        {
            Restriction.PropertyRestriction propertyRestriction;
            switch (filter.ComparisonOperator)
            {
            case ComparisonOperator.Equal:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.EQ(ptagToSearch, propValue);
                break;

            case ComparisonOperator.NotEqual:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.NE(ptagToSearch, propValue);
                break;

            case ComparisonOperator.LessThan:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.LT(ptagToSearch, propValue);
                break;

            case ComparisonOperator.LessThanOrEqual:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.LE(ptagToSearch, propValue);
                break;

            case ComparisonOperator.GreaterThan:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.GT(ptagToSearch, propValue);
                break;

            case ComparisonOperator.GreaterThanOrEqual:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.GE(ptagToSearch, propValue);
                break;

            default:
                throw ContentFilterBuilder.UnexpectedFilterType(filter);
            }
            if (ptagToSearch.IsMultiValued())
            {
                propertyRestriction.MultiValued = true;
            }
            return(propertyRestriction);
        }
Example #4
0
        // Token: 0x0600134B RID: 4939 RVA: 0x00070834 File Offset: 0x0006EA34
        public static OABProperty[] CreateOABPropertyList(Dictionary <PropTag, OABPropertyFlags> rawPropertyList)
        {
            OABProperty.Tracer.TraceFunction(0L, "OABProperty.CreateOABPropertyList");
            if (rawPropertyList.ContainsKey((PropTag)2363293707U))
            {
                OABProperty.Tracer.TraceDebug(0L, "HAB is enabled");
                if (!rawPropertyList.ContainsKey((PropTag)2148077598U))
                {
                    rawPropertyList[(PropTag)2148077598U] = OABPropertyFlags.Truncated;
                }
                if (!rawPropertyList.ContainsKey((PropTag)2148012062U))
                {
                    rawPropertyList[(PropTag)2148012062U] = OABPropertyFlags.Truncated;
                }
            }
            rawPropertyList.Remove(OABFilePropTags.TruncatedProperties);
            List <OABProperty> list = new List <OABProperty>(rawPropertyList.Count + 1);

            foreach (KeyValuePair <PropTag, OABPropertyFlags> keyValuePair in rawPropertyList)
            {
                PropTag          key   = keyValuePair.Key;
                OABPropertyFlags value = keyValuePair.Value;
                OABProperty.Tracer.TraceDebug <PropTag>(0L, "Adding PropTag {0}...", key);
                if (key == (PropTag)2355953922U)
                {
                    OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating ObjectGuidOABProperty for PropTag {0}...", key);
                    list.Add(new OABProperty.ObjectGuidOABProperty(key, value));
                }
                else if ((value & OABPropertyFlags.Truncated) != OABPropertyFlags.None)
                {
                    if (key == (PropTag)2148077598U || key == (PropTag)2148012062U)
                    {
                        OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating HABGroupMemberOABProperty for PropTag {0}...", key);
                        list.Add(new OABProperty.HABGroupMemberOABProperty(key, value));
                    }
                    else
                    {
                        PropertyDefinition propertyDefinition = NspiPropMapper.GetPropertyDefinition(key);
                        if (propertyDefinition != null && propertyDefinition.Type == typeof(ADObjectId))
                        {
                            OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating TruncatedLinkOABProperty for PropTag {0}...", key);
                            list.Add(new OABProperty.TruncatedLinkOABProperty(key, value));
                        }
                        else
                        {
                            OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating TruncatedOABProperty for PropTag {0}...", key);
                            list.Add(new OABProperty.TruncatedOABProperty(key, value));
                        }
                    }
                }
                else if (key == (PropTag)2355761410U)
                {
                    OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating X509CertificateProperty for PropTag {0}...", key);
                    list.Add(new OABProperty.X509CertificateProperty(key, value));
                }
                else if (key.IsMultiValued())
                {
                    OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating MultivaluedProperty for PropTag {0}...", key);
                    list.Add(new OABProperty.MultivaluedProperty(key, value));
                }
                else
                {
                    OABProperty.Tracer.TraceDebug <PropTag>(0L, "Instantiating OABProperty for PropTag {0}...", key);
                    list.Add(new OABProperty(key, value));
                }
            }
            list.Add(new OABProperty.TruncatedPropertiesOABProperty(OABFilePropTags.TruncatedProperties, OABPropertyFlags.None));
            return(list.ToArray());
        }
Example #5
0
 internal static bool IsMultiValueTag(PropTag tag)
 {
     return(tag.IsMultiValued());
 }