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; } } }
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; } } }
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)); }
public static UIHint GetUIHint(object[] attributes) { UIHintAttribute attribute = CustomAttributeHelpers.GetAttribute <UIHintAttribute>(attributes); if (attribute == null) { return(0); } return(attribute.get_Hint()); }
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)); }
public static string GetActionSection(IEnumerable <object> attributes) { ActionSection attribute = CustomAttributeHelpers.GetAttribute <ActionSection>(attributes); if (attribute == null) { return(null); } return(attribute.get_Section()); }
public static string GetNote(IEnumerable <object> attributes) { NoteAttribute attribute = CustomAttributeHelpers.GetAttribute <NoteAttribute>(attributes); if (attribute == null) { return(null); } return(attribute.get_Text()); }
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); } }
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)); } } }
public static T GetAttribute <T>(Type type) where T : Attribute { return(CustomAttributeHelpers.GetAttribute <T>(CustomAttributeHelpers.GetCustomAttributes(type) as Attribute[])); }
public static T GetAttribute <T>(FieldInfo fieldInfo) where T : Attribute { return(CustomAttributeHelpers.GetAttribute <T>(fieldInfo.GetCustomAttributes(true))); }