internal static GuidIdPropertyDefinition InternalCreate(string displayName, Type propertyType, PropType mapiPropType, Guid propertyGuid, int dispId, PropertyFlags flags, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, bool isCustom, params PropertyDefinitionConstraint[] constraints) { if (mapiPropType == PropType.AnsiString) { mapiPropType = PropType.String; propertyType = typeof(string); } else if (mapiPropType == PropType.AnsiStringArray) { mapiPropType = PropType.StringArray; propertyType = typeof(string[]); } NamedProp namedProp = new NamedProp(propertyGuid, dispId); NamedProp namedProp2 = WellKnownNamedProperties.Find(namedProp); if (namedProp2 != null) { namedProp = namedProp2; } else { namedProp = NamedPropertyDefinition.NamedPropertyKey.GetSingleton(namedProp); } GuidIdPropertyDefinition.GuidIdKey guidIdKey = new GuidIdPropertyDefinition.GuidIdKey(namedProp); bool flag; if (propertyGuid == WellKnownPropertySet.InternetHeaders) { NativeStorePropertyDefinition.OnFailedPropertyTypeCheck(guidIdKey, mapiPropType, typeCheckingFlag, out flag); return(null); } GuidIdPropertyDefinition result; if (GuidIdPropertyDefinition.TryFindEquivalentDefinition(guidIdKey, isCustom, mapiPropType, typeCheckingFlag, out result, out flag)) { return(result); } if (!flag) { return(null); } return(new GuidIdPropertyDefinition(displayName, propertyType, mapiPropType, guidIdKey, flags, isCustom, constraints)); }
internal static bool TryFindEquivalentDefinition(PropertyTagPropertyDefinition.PropTagKey key, bool isCustom, PropType type, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, out PropertyTagPropertyDefinition definition, out bool createNewDefinition) { createNewDefinition = true; if (!isCustom) { definition = null; return(false); } switch (NativeStorePropertyDefinitionDictionary.TryFindInstance(key, type, out definition)) { case PropertyMatchResult.Found: createNewDefinition = false; return(true); case PropertyMatchResult.TypeMismatch: NativeStorePropertyDefinition.OnFailedPropertyTypeCheck(key, type, typeCheckingFlag, out createNewDefinition); break; } return(false); }