private static void RegisterType(Type type)
        {
            string name = type.FullName;

            var info = new EditorTypeInfo
            {
                Type = type
            };

            var displayAttr = type.GetCustomAttributes(typeof(DisplayNameAttribute), true);

            if (displayAttr != null && displayAttr.Length > 0)
            {
                info.DisplayName = ((DisplayNameAttribute)displayAttr[0]).DisplayName;
            }
            else
            {
                info.DisplayName = type.FullName;
            }

            var optionsAttr = type.GetCustomAttributes(typeof(OptionsTypeAttribute), true);

            if (optionsAttr != null && optionsAttr.Length > 0)
            {
                info.OptionsType = ((OptionsTypeAttribute)optionsAttr[0]).OptionsType;
            }

            registeredTypes[name] = info;
        }
예제 #2
0
        private static void RegisterType(Type type)
        {
            string name = type.FullName;

            var info = new EditorTypeInfo
            {
                Type = type
            };

            var displayAttr = type.GetCustomAttributes(typeof(DisplayNameAttribute), true);
            if (displayAttr != null && displayAttr.Length > 0)
                info.DisplayName = ((DisplayNameAttribute)displayAttr[0]).DisplayName;
            else
                info.DisplayName = type.FullName;

            var optionsAttr = type.GetCustomAttributes(typeof(OptionsTypeAttribute), true);
            if (optionsAttr != null && optionsAttr.Length > 0)
                info.OptionsType = ((OptionsTypeAttribute)optionsAttr[0]).OptionsType;

            registeredTypes[name] = info;
        }