protected override object ReadValue() { if (this.IsLargeValue()) { StorageGlobals.ContextTraceError(ExTraceGlobals.CcInboundTnefTracer, "InboundTnefConverter::ReadValue: large property value"); throw new ConversionFailedException(ConversionFailureReason.CorruptContent); } if (this.PropertyReader.IsMultiValuedProperty) { Type elementType = InternalSchema.ClrTypeFromPropTagType(ConvertUtils.GetPropertyBaseType(this.PropertyReader.PropertyTag)); List <object> list = new List <object>(); while (this.PropertyReader.ReadNextValue()) { if (this.PropertyReader.IsLargeValue) { throw new ConversionFailedException(ConversionFailureReason.CorruptContent, ServerStrings.LargeMultivaluedPropertiesNotSupportedInTNEF, null); } object obj = this.ReadSingleValue(); if (obj == null) { throw new ConversionFailedException(ConversionFailureReason.CorruptContent, ServerStrings.InvalidTnef, null); } list.Add(obj); } Array array = Array.CreateInstance(elementType, list.Count); for (int i = 0; i < array.Length; i++) { array.SetValue(list[i], i); } return(array); } return(this.ReadSingleValue()); }
private static NativeStorePropertyDefinition GetPropDefByMapiNamedProp(NamedProp prop, PropType type, NativeStorePropertyDefinition.TypeCheckingFlag propertyTypeCheckingFlag) { if (prop == null) { return(null); } switch (prop.Kind) { case NamedPropKind.Id: return(GuidIdPropertyDefinition.InternalCreateCustom(string.Empty, type, prop.Guid, prop.Id, PropertyFlags.None, propertyTypeCheckingFlag, new PropertyDefinitionConstraint[0])); case NamedPropKind.String: if (GuidNamePropertyDefinition.IsValidName(prop.Guid, prop.Name)) { return(GuidNamePropertyDefinition.InternalCreate(string.Empty, InternalSchema.ClrTypeFromPropTagType(type), type, prop.Guid, prop.Name, PropertyFlags.None, propertyTypeCheckingFlag, true, PropertyDefinitionConstraint.None)); } return(null); default: throw new ArgumentOutOfRangeException("prop.Kind"); } }
internal static GuidNamePropertyDefinition InternalCreateCustom(string displayName, PropType mapiPropType, Guid propertyGuid, string propertyName, PropertyFlags flags, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, params PropertyDefinitionConstraint[] constraints) { Type propertyType = InternalSchema.ClrTypeFromPropTagType(mapiPropType); return(GuidNamePropertyDefinition.InternalCreate(displayName, propertyType, mapiPropType, propertyGuid, propertyName, flags | PropertyFlags.Custom, typeCheckingFlag, true, constraints)); }
public static GuidIdPropertyDefinition CreateCustom(string displayName, ushort mapiPropertyType, Guid propertyGuid, int dispId, PropertyFlags flags) { return(GuidIdPropertyDefinition.CreateCustom(displayName, InternalSchema.ClrTypeFromPropTagType((PropType)mapiPropertyType), propertyGuid, dispId, flags, PropertyDefinitionConstraint.None)); }