protected NativeStorePropertyDefinition CreatePropertyDefinition(TnefPropertyTag propertyTag, TnefNameId?namedProperty) { PropType tnefType = (PropType)propertyTag.TnefType; if (tnefType == PropType.Error || tnefType == PropType.Null || tnefType == PropType.ObjectArray || tnefType == PropType.Unspecified) { return(null); } if (tnefType == PropType.Object && propertyTag != TnefPropertyTag.AttachDataObj) { return(null); } if (namedProperty == null) { return(PropertyTagPropertyDefinition.InternalCreateCustom(string.Empty, (PropTag)propertyTag, PropertyFlags.None, NativeStorePropertyDefinition.TypeCheckingFlag.DoNotCreateInvalidType)); } Guid propertySetGuid = namedProperty.Value.PropertySetGuid; if (namedProperty.Value.Kind == TnefNameIdKind.Id) { return(GuidIdPropertyDefinition.InternalCreateCustom(string.Empty, tnefType, propertySetGuid, namedProperty.Value.Id, PropertyFlags.None, NativeStorePropertyDefinition.TypeCheckingFlag.DoNotCreateInvalidType, new PropertyDefinitionConstraint[0])); } string name = namedProperty.Value.Name; if (!GuidNamePropertyDefinition.IsValidName(propertySetGuid, name)) { return(null); } return(GuidNamePropertyDefinition.InternalCreateCustom(string.Empty, tnefType, propertySetGuid, name, PropertyFlags.None, NativeStorePropertyDefinition.TypeCheckingFlag.DoNotCreateInvalidType, new PropertyDefinitionConstraint[0])); }
public static PropertyTagPropertyDefinition CreateCustom(string displayName, uint propertyTag, PropertyFlags flags, params PropertyDefinitionConstraint[] constraints) { return(PropertyTagPropertyDefinition.InternalCreateCustom(displayName, (PropTag)propertyTag, flags, NativeStorePropertyDefinition.TypeCheckingFlag.ThrowOnInvalidType, constraints)); }
internal static PropertyTagPropertyDefinition InternalCreateCustom(string displayName, PropTag propertyTag, PropertyFlags flags, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag) { return(PropertyTagPropertyDefinition.InternalCreateCustom(displayName, propertyTag, flags, typeCheckingFlag, PropertyDefinitionConstraint.None)); }
internal NativeStorePropertyDefinition[] InternalPropertyDefinitionsFromPropTags(NativeStorePropertyDefinition.TypeCheckingFlag propertyTypeCheckingFlag, MapiProp mapiProp, StoreSession storeSession, PropTag[] propTags, out int resolvedPropertyCount) { EnumValidator.ThrowIfInvalid <NativeStorePropertyDefinition.TypeCheckingFlag>(propertyTypeCheckingFlag, "propertyTypeCheckingFlag"); resolvedPropertyCount = 0; NativeStorePropertyDefinition[] array = new NativeStorePropertyDefinition[propTags.Length]; List <PropertyTagCache.NamedPropertyToResolve> list = null; PropTag[] array2 = null; for (int i = 0; i < propTags.Length; i++) { PropTag propTag = propTags[i]; if (!PropertyTagCache.TryFixPropTagWithErrorType(storeSession, mapiProp, ref array2, ref propTag)) { ExTraceGlobals.PropertyMappingTracer.TraceError <PropTag>((long)storeSession.GetHashCode(), "Failed to infer the property type for PropertyTag {0:X}", propTag); } else { PropertyTagCache.ChangeStringPropTagTypeToUnicode(ref propTag); int num = propTag.Id(); if (num < 32768) { NativeStorePropertyDefinition nativeStorePropertyDefinition = PropertyTagPropertyDefinition.InternalCreateCustom(string.Empty, propTag, PropertyFlags.None, propertyTypeCheckingFlag); array[i] = nativeStorePropertyDefinition; if (nativeStorePropertyDefinition != null) { resolvedPropertyCount++; } } else { if (list == null) { list = new List <PropertyTagCache.NamedPropertyToResolve>(); } list.Add(new PropertyTagCache.NamedPropertyToResolve((ushort)num, propTag.ValueType(), i)); } } } if (list != null) { NamedProp[] namedPropsFromIds = NamedPropConverter.GetNamedPropsFromIds(storeSession, mapiProp, from namedPropertyToResolve in list select namedPropertyToResolve.PropId); int num2 = 0; foreach (PropertyTagCache.NamedPropertyToResolve namedPropertyToResolve2 in list) { NativeStorePropertyDefinition propDefByMapiNamedProp = PropertyTagCache.GetPropDefByMapiNamedProp(namedPropsFromIds[num2++], namedPropertyToResolve2.PropType, propertyTypeCheckingFlag); array[namedPropertyToResolve2.Index] = propDefByMapiNamedProp; if (propDefByMapiNamedProp != null) { resolvedPropertyCount++; } else { ExTraceGlobals.PropertyMappingTracer.TraceDebug <ushort, PropType>((long)storeSession.GetHashCode(), "Failed to resolve a named property from PropertyId {0:X} [{1:X}]", namedPropertyToResolve2.PropId, namedPropertyToResolve2.PropType); } } } return(array); }