Example #1
0
 public static void Rebuild()
 {
     CustomActionEditors.Clear();
     Assembly[] assemblies = AppDomain.get_CurrentDomain().GetAssemblies();
     for (int i = 0; i < assemblies.Length; i++)
     {
         Assembly assembly = assemblies[i];
         try
         {
             Type[] exportedTypes = assembly.GetExportedTypes();
             Type[] array         = exportedTypes;
             for (int j = 0; j < array.Length; j++)
             {
                 Type type = array[j];
                 if (typeof(CustomActionEditor).IsAssignableFrom(type) && type.get_IsClass() && !type.get_IsAbstract())
                 {
                     CustomActionEditorAttribute attribute = CustomAttributeHelpers.GetAttribute <CustomActionEditorAttribute>(type);
                     if (attribute != null)
                     {
                         CustomActionEditors.editorsLookup.Add(attribute.InspectedType, type);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             NotSupportedException arg_87_0 = ex as NotSupportedException;
         }
     }
 }
Example #2
0
 public static void Rebuild()
 {
     PropertyDrawers.drawers = new Dictionary <Type, PropertyDrawer>();
     Assembly[] assemblies = AppDomain.get_CurrentDomain().GetAssemblies();
     for (int i = 0; i < assemblies.Length; i++)
     {
         Assembly assembly = assemblies[i];
         try
         {
             Type[] exportedTypes = assembly.GetExportedTypes();
             Type[] array         = exportedTypes;
             for (int j = 0; j < array.Length; j++)
             {
                 Type type = array[j];
                 if (typeof(PropertyDrawer).IsAssignableFrom(type) && type.get_IsClass() && !type.get_IsAbstract())
                 {
                     PropertyDrawerAttribute attribute = CustomAttributeHelpers.GetAttribute <PropertyDrawerAttribute>(type);
                     Type type2 = (attribute != null) ? attribute.InspectedType : null;
                     if (type2 != null && !PropertyDrawers.drawers.ContainsKey(type2))
                     {
                         PropertyDrawers.drawers.Add(type2, (PropertyDrawer)Activator.CreateInstance(type));
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             NotSupportedException arg_B2_0 = ex as NotSupportedException;
         }
     }
 }
Example #3
0
        private static void FindObjectTypeAttribute(Type actionType, FieldInfo field)
        {
            ObjectTypeAttribute attribute = CustomAttributeHelpers.GetAttribute <ObjectTypeAttribute>(field);

            if (attribute == null || attribute.get_ObjectType() == null)
            {
                return;
            }
            ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_ObjectType(), field.get_Name(), false));
        }
Example #4
0
        public static UIHint GetUIHint(object[] attributes)
        {
            UIHintAttribute attribute = CustomAttributeHelpers.GetAttribute <UIHintAttribute>(attributes);

            if (attribute == null)
            {
                return(0);
            }
            return(attribute.get_Hint());
        }
Example #5
0
        public static Type GetObjectType(object[] attributes, Type defaultType = null)
        {
            ObjectTypeAttribute attribute = CustomAttributeHelpers.GetAttribute <ObjectTypeAttribute>(attributes);

            if (attribute != null)
            {
                return(attribute.get_ObjectType());
            }
            return(defaultType ?? typeof(Object));
        }
Example #6
0
        public static string GetActionSection(IEnumerable <object> attributes)
        {
            ActionSection attribute = CustomAttributeHelpers.GetAttribute <ActionSection>(attributes);

            if (attribute == null)
            {
                return(null);
            }
            return(attribute.get_Section());
        }
Example #7
0
        public static string GetNote(IEnumerable <object> attributes)
        {
            NoteAttribute attribute = CustomAttributeHelpers.GetAttribute <NoteAttribute>(attributes);

            if (attribute == null)
            {
                return(null);
            }
            return(attribute.get_Text());
        }
Example #8
0
        public static string GetTooltip(Type type, IEnumerable <object> attributes)
        {
            string           text      = Labels.GetTypeTooltip(type);
            TooltipAttribute attribute = CustomAttributeHelpers.GetAttribute <TooltipAttribute>(attributes);

            if (attribute != null)
            {
                text = text + Environment.get_NewLine() + attribute.get_Text();
            }
            return(text);
        }
        public static void OpenWikiPage(SkillStateAction action)
        {
            HelpUrlAttribute attribute = CustomAttributeHelpers.GetAttribute <HelpUrlAttribute>(action.GetType());

            if (attribute != null)
            {
                Application.OpenURL(attribute.get_Url());
                return;
            }
            string topic = Labels.StripNamespace(action.ToString());

            if (!EditorCommands.OpenWikiPage(topic))
            {
                EditorCommands.SearchWikiHelp(action);
            }
        }
Example #10
0
        private static void FindCheckForComponentAttribute(Type actionType, FieldInfo field)
        {
            CheckForComponentAttribute attribute = CustomAttributeHelpers.GetAttribute <CheckForComponentAttribute>(field);

            if (attribute != null)
            {
                if (attribute.get_Type0() != null)
                {
                    ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_Type0(), field.get_Name(), false));
                }
                if (attribute.get_Type1() != null)
                {
                    ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_Type1(), field.get_Name(), false));
                }
                if (attribute.get_Type2() != null)
                {
                    ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_Type2(), field.get_Name(), false));
                }
            }
        }
Example #11
0
 public static T GetAttribute <T>(Type type) where T : Attribute
 {
     return(CustomAttributeHelpers.GetAttribute <T>(CustomAttributeHelpers.GetCustomAttributes(type) as Attribute[]));
 }
Example #12
0
 public static T GetAttribute <T>(FieldInfo fieldInfo) where T : Attribute
 {
     return(CustomAttributeHelpers.GetAttribute <T>(fieldInfo.GetCustomAttributes(true)));
 }