public static bool HasValidCustomNodeAttribute(Type t) { CustomNode attr = t.GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode; return(attr != null && !string.IsNullOrEmpty(attr.Name)); }
private static List <DataModel.CustomNodeInfo> BuildCustomNodeList(string group) { var list = new List <DataModel.CustomNodeInfo>(); var allNodes = new List <Type>(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { var nodes = assembly.GetTypes() .Where(t => t != typeof(DataModel.Node)) .Where(t => typeof(DataModel.Node).IsAssignableFrom(t)); allNodes.AddRange(nodes); } foreach (var type in allNodes) { CustomNode attr = type.GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode; if (attr != null && attr.Group == group) { list.Add(new DataModel.CustomNodeInfo(type, attr)); } } list.Sort(); return(list); }
public static string GetNodeGUIName(DataModel.Node node) { CustomNode attr = node.GetType().GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode; if (attr != null) { return(attr.Name); } return(string.Empty); }
public static int GetNodeOrderPriority(string className) { var type = Type.GetType(className); if (type != null) { CustomNode attr = type.GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode; if (attr != null) { return(attr.OrderPriority); } } return(CustomNode.kDEFAULT_PRIORITY); }
public static string GetNodeGUIName(string className) { var type = Type.GetType(className); if (type != null) { CustomNode attr = type.GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode; if (attr != null) { return(attr.Name); } } return(string.Empty); }