Esempio n. 1
0
        /// <summary>
        ///   Gets inspector data such as name and description for the
        ///   specified type.
        /// </summary>
        /// <param name="type">Type to get inspector data for.</param>
        /// <param name="conditionalInspectors">Dictionary to be filled with conditions for inspectors to be shown.</param>
        /// <returns>Inspector data for the specified type.</returns>
        public static InspectorType GetInspectorType(
            Type type,
            ref Dictionary <InspectorPropertyAttribute, InspectorConditionalPropertyAttribute> conditionalInspectors)
        {
            List <InspectorPropertyAttribute> inspectorProperties = InspectorUtils.CollectInspectorProperties(
                type, ref conditionalInspectors);

            var inspectorTypeAttribute = type.GetAttribute <InspectorTypeAttribute>();

            if (inspectorTypeAttribute == null)
            {
                return(null);
            }

            var inspectorTypeData = new InspectorType
            {
                Attribute   = inspectorTypeAttribute,
                Name        = type.Name,
                Description = inspectorTypeAttribute.Description,
                Properties  = inspectorProperties,
                Type        = type,
            };

            return(inspectorTypeData);
        }