Exemple #1
0
 private static NamedPropertyDefinition.NamedPropertyKey[] MapiNamedPropToNamedPropertyKey(NamedProp[] namedProps)
 {
     NamedPropertyDefinition.NamedPropertyKey[] array = new NamedPropertyDefinition.NamedPropertyKey[namedProps.Length];
     for (int i = 0; i < namedProps.Length; i++)
     {
         NamedProp namedProp = namedProps[i];
         if (namedProp == null)
         {
             array[i] = null;
         }
         else
         {
             NamedProp namedProp2 = WellKnownNamedProperties.Find(namedProp);
             if (namedProp2 != null)
             {
                 namedProp = namedProp2;
             }
             else
             {
                 namedProp = NamedPropertyDefinition.NamedPropertyKey.GetSingleton(namedProp);
             }
             if (namedProp.Kind == NamedPropKind.Id)
             {
                 array[i] = new GuidIdPropertyDefinition.GuidIdKey(namedProp);
             }
             else
             {
                 array[i] = new GuidNamePropertyDefinition.GuidNameKey(namedProp);
             }
         }
     }
     return(array);
 }
Exemple #2
0
        internal static bool TryFindEquivalentDefinition(GuidNamePropertyDefinition.GuidNameKey key, bool isCustom, PropType type, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, out GuidNamePropertyDefinition definition, out bool createNewDefinition)
        {
            createNewDefinition = true;
            if (!isCustom)
            {
                definition = null;
                return(false);
            }
            switch (NativeStorePropertyDefinitionDictionary.TryFindInstance(key, type, typeCheckingFlag == NativeStorePropertyDefinition.TypeCheckingFlag.AllowCompatibleType, out definition))
            {
            case PropertyMatchResult.Found:
                createNewDefinition = false;
                return(true);

            case PropertyMatchResult.TypeMismatch:
                NativeStorePropertyDefinition.OnFailedPropertyTypeCheck(key, type, typeCheckingFlag, out createNewDefinition);
                break;
            }
            return(false);
        }
Exemple #3
0
        internal static GuidNamePropertyDefinition InternalCreate(string displayName, Type propertyType, PropType mapiPropType, Guid propertyGuid, string propertyName, PropertyFlags flags, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, bool isCustom, params PropertyDefinitionConstraint[] constraints)
        {
            if (!GuidNamePropertyDefinition.IsValidName(propertyGuid, propertyName))
            {
                throw new ArgumentException("Invalid property name for property", "propertyName");
            }
            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, propertyName);
            NamedProp namedProp2 = WellKnownNamedProperties.Find(namedProp);

            if (namedProp2 != null)
            {
                namedProp = namedProp2;
            }
            else
            {
                namedProp = NamedPropertyDefinition.NamedPropertyKey.GetSingleton(namedProp);
            }
            GuidNamePropertyDefinition.GuidNameKey guidNameKey = new GuidNamePropertyDefinition.GuidNameKey(namedProp);
            GuidNamePropertyDefinition             result;
            bool flag;

            if (GuidNamePropertyDefinition.TryFindEquivalentDefinition(guidNameKey, isCustom, mapiPropType, typeCheckingFlag, out result, out flag))
            {
                return(result);
            }
            if (!flag)
            {
                return(null);
            }
            return(new GuidNamePropertyDefinition(displayName, propertyType, mapiPropType, guidNameKey, flags, isCustom, constraints));
        }
Exemple #4
0
 private GuidNamePropertyDefinition(string displayName, Type propertyType, PropType mapiPropertyType, GuidNamePropertyDefinition.GuidNameKey key, PropertyFlags flags, bool isCustom, PropertyDefinitionConstraint[] constraints) : base(PropertyTypeSpecifier.GuidString, displayName, propertyType, mapiPropertyType, GuidNamePropertyDefinition.CalculatePropertyTagPropertyFlags(key.PropertyName, key.PropertyGuid, flags, isCustom), constraints)
 {
     this.InternalKey = key;
     this.hashCode    = (this.Guid.GetHashCode() ^ this.PropertyName.GetHashCode() ^ (int)base.MapiPropertyType);
 }