public static Dictionary<string, NodeInfo> LoadIntrinsicObjects() { Dictionary<string, NodeInfo> rootNodes = new Dictionary<string, NodeInfo>(); rootNodes["input"] = new NodeInfo(typeof(IZeusInput), "input"); rootNodes["output"] = new NodeInfo(typeof(IZeusOutput), "output"); rootNodes["context"] = new NodeInfo(typeof(IZeusContext), "context"); foreach (IZeusIntrinsicObject zio in ZeusFactory.IntrinsicObjectsArray) { try { NodeInfo node = new NodeInfo(zio.Assembly.GetType(zio.ClassPath), zio.VariableName); rootNodes[node.Name] = node; } catch { } } if (!rootNodes.ContainsKey("gui")) rootNodes["gui"] = new NodeInfo(typeof(IZeusGuiControl), "gui"); return rootNodes; }
public static NodeInfo BuildNodeInfo(MemberInfo mi) { NodeInfo node = null; if (mi.MemberType == MemberTypes.Field) { FieldInfo f = mi as FieldInfo; if (f.IsPublic && !f.IsStatic) { node = new NodeInfo(f.FieldType, f.Name, f.MemberType, null); } } else if (mi.MemberType == MemberTypes.Method) { MethodInfo m = mi as MethodInfo; if (m.IsPublic && !m.IsStatic) { node = new NodeInfo(m.ReturnType, m.Name, m.MemberType, m.GetParameters()); } } else if (mi.MemberType == MemberTypes.Property) { PropertyInfo p = mi as PropertyInfo; MethodInfo m = null; if (p.CanRead) { m = p.GetGetMethod(); } else if (p.CanWrite) { m = p.GetSetMethod(); } if (m != null) { if (m.IsPublic && !m.IsStatic) { node = new NodeInfo(p.PropertyType, p.Name, p.MemberType, null); } } } return node; }