Пример #1
0
        /// <summary>
        /// Retrieves a known property by identifier
        /// Returns null if not known
        /// </summary>
        /// <param name="identifier">Identifier to search for</param>
        /// <returns>Known property or null</returns>
        public static SgfKnownProperty Get(string identifier)
        {
            if (identifier == null)
            {
                throw new ArgumentNullException(nameof(identifier));
            }
            SgfKnownProperty property = null;

            KnownProperties.TryGetValue(identifier, out property);
            return(property);
        }
Пример #2
0
        /// <summary>
        /// Returns the type of property
        /// </summary>
        /// <param name="propertyIdentifier">Property identifier</param>
        /// <returns>Type of property</returns>
        public static SgfPropertyType GetPropertyType(string propertyIdentifier)
        {
            if (propertyIdentifier == null)
            {
                return(SgfPropertyType.Invalid);
            }

            //check if the property identifier is known
            SgfKnownProperty property = SgfKnownProperties.Get(propertyIdentifier);

            if (property != null)
            {
                return(property.Type);
            }

            //check if the property identifier is valid
            if (IsPropertyIdentifierValid(propertyIdentifier))
            {
                return(SgfPropertyType.Unknown);
            }

            //invalid property
            return(SgfPropertyType.Invalid);
        }