Example #1
0
 protected virtual ArrayListSerialized Functions(NodesCollection c, NodeDescriptor d)
 {
     ArrayListSerialized res = new ArrayListSerialized();
     ILisp l = Lisp.Current;
     foreach (Symbol s in l.Interpreter.CurrentPackage.ExternalTable.GetSymbols() ){
         if (s.IsDefined && s.GlobalValue is Front.Lisp.Closure) {
             NodeDescriptor n = c.GetDescriptor(s.GlobalValue);
             n.NodePath = s.Name;
             n.NodeName = s.Name;
             res.Add(n);
             c.Add(n);
         }
     }
     foreach (Symbol s in l.Interpreter.CurrentPackage.InternalTable.GetSymbols()) {
         if (s.IsDefined && s.GlobalValue is Front.Lisp.Closure ) {
             NodeDescriptor n = c.GetDescriptor(s.GlobalValue);
             n.NodePath = s.Name;
             n.NodeName = s.Name;
             res.Add(n);
             c.Add(n);
         }
     }
     return res;
 }
Example #2
0
        //Public'i Fields
        protected virtual ArrayList GetPublicFields(NodesCollection c, NodeDescriptor node)
        {
            ArrayList publishedFields = new ArrayList();
            Type typeresolver = node.NodeObject.GetType();

            FieldInfo[] publicFields = typeresolver.GetFields(BindingFlags.Public | BindingFlags.Instance);
            if (publicFields.Length > 0) {
                foreach (FieldInfo field in publicFields) {
                    object obj = field.GetValue(node.NodeObject);
                    NodeDescriptor subNode = c.GetDescriptor(obj);

                    subNode.NodeName = field.Name;
                    subNode.NodeMembership = NodeMemberships.isField;
                    subNode.NodePublicity = NodePublicities.isPublic;

                    node.SubNodes.Add(subNode);
                }
            }
            return publishedFields;
        }
Example #3
0
        protected virtual NodeDescriptor ExtractProperty(NodesCollection c, NodeDescriptor node, PropertyInfo property)
        {
            NodeDescriptor subNode;
            object obj = null;

            ParameterInfo[] parInfos = property.GetIndexParameters();
            if (parInfos.Length == 0) {
                try {
                    obj = property.GetValue(node.NodeObject, null);
                    subNode = c.GetDescriptor(obj);
                } catch (Exception ex){
                    return c.GetDescriptor(ex);
                }

            } else {
                obj = property;
                subNode = c.GetDescriptor(obj);

                subNode.MembersCount = parInfos.Length;
                subNode.TypeName = property.ReflectedType.Name;

                subNode.Value = "";
                foreach (ParameterInfo parInfo in parInfos) {
                    subNode.Value += string.Format("[{0} {1}]  ", parInfo.Name, parInfo.ParameterType.Name);
                }
            }
            return subNode;
        }