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);
        }
        private static PropertyTagPropertyDefinition InternalCreate(string displayName, PropTag propertyTag, PropertyFlags flags, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, bool isCustom, PropertyDefinitionConstraint[] constraints)
        {
            if (!propertyTag.IsValid())
            {
                throw new ArgumentException("Invalid property tag", "propertyTag");
            }
            PropType propType = propertyTag.ValueType();

            if (propType == PropType.AnsiString || propType == PropType.AnsiStringArray)
            {
                propertyTag = ((propertyTag & (PropTag)4294967265U) | (PropTag)31U);
                propType    = propertyTag.ValueType();
            }
            PropertyTagPropertyDefinition.PropTagKey propTagKey = new PropertyTagPropertyDefinition.PropTagKey(propertyTag);
            PropertyTagPropertyDefinition            result;
            bool flag;

            if (PropertyTagPropertyDefinition.TryFindEquivalentDefinition(propTagKey, isCustom, propType, typeCheckingFlag, out result, out flag))
            {
                return(result);
            }
            if (flag)
            {
                try
                {
                    return(new PropertyTagPropertyDefinition(displayName, propertyTag, propTagKey, flags, isCustom, constraints));
                }
                catch (InvalidPropertyTypeException)
                {
                    if (typeCheckingFlag == NativeStorePropertyDefinition.TypeCheckingFlag.ThrowOnInvalidType)
                    {
                        throw;
                    }
                }
            }
            return(null);
        }
 private PropertyTagPropertyDefinition(string displayName, PropTag propertyTag, PropertyTagPropertyDefinition.PropTagKey key, PropertyFlags flags, bool isCustom, PropertyDefinitionConstraint[] constraints) : base(PropertyTypeSpecifier.PropertyTag, displayName, InternalSchema.ClrTypeFromPropTag(propertyTag), propertyTag.ValueType(), PropertyTagPropertyDefinition.CalculatePropertyTagPropertyFlags(propertyTag, flags), constraints)
 {
     if (propertyTag.IsNamedProperty() || !propertyTag.IsValid())
     {
         throw new ArgumentException("Invalid property tag", "propertyTag");
     }
     this.InternalKey = key;
     this.propertyTag = propertyTag;
 }