Ejemplo n.º 1
0
        public static bool HasValidCustomNodeAttribute(Type t)
        {
            CustomNode attr =
                t.GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode;

            return(attr != null && !string.IsNullOrEmpty(attr.Name));
        }
Ejemplo n.º 2
0
        private static List <CustomNodeInfo> BuildCustomNodeList()
        {
            var list = new List <CustomNodeInfo>();

            var allNodes = new List <Type>();

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                var nodes = assembly.GetTypes()
                            .Where(t => t != typeof(Node))
                            .Where(t => typeof(Node).IsAssignableFrom(t));
                allNodes.AddRange(nodes);
            }

            foreach (var type in allNodes)
            {
                CustomNode attr =
                    type.GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode;

                if (attr != null)
                {
                    list.Add(new CustomNodeInfo(type, attr));
                }
            }

            list.Sort();

            return(list);
        }
Ejemplo n.º 3
0
        public static string GetNodeGUIName(Node node)
        {
            CustomNode attr =
                node.GetType().GetCustomAttributes(typeof(CustomNode), false).FirstOrDefault() as CustomNode;

            if (attr != null)
            {
                return(attr.Name);
            }
            return(string.Empty);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public CustomNodeInfo(Type t, CustomNode n)
 {
     node = n;
     type = t;
 }