Ejemplo n.º 1
0
        public void HandleType(TypeDef type, bool processChildren)
        {
            TreeNode targetType = _treeViewHandler.NewType(type);

            if (processChildren)
            {
                var children = new List <TreeNode>();
                ProcessTypeMembers(targetType, ref children);

                foreach (var child in children)
                {
                    targetType.Nodes.Add(child);
                }
            }

            if (type.IsExpandable())
            {
                VirtualNodeUtilities.NewVirtualNode().AddTo(targetType);
            }

            if (!_treeViewHandler.NameSpaceList.Contains(type.Namespace))
            {
                TreeNode nameSpace = _treeViewHandler.NewNameSpace(type.Namespace);

                _treeViewHandler.NameSpaceList.Add(type.Namespace);

                _treeViewHandler.CurrentTreeView.BeginInvoke(new MethodInvoker(() =>
                {
                    nameSpace.AddTo(_treeViewHandler.CurrentModule);
                    targetType.AddTo(nameSpace);
                }));
            }
            else
            {
                _treeViewHandler.CurrentTreeView.BeginInvoke(new MethodInvoker(() =>
                                                                               targetType.AddTo(_treeViewHandler.CurrentModule.Nodes.Cast <TreeNode>().First(
                                                                                                    n => n.Text == type.Namespace))));
            }
        }
Ejemplo n.º 2
0
        public void ProcessTypeMembers(TreeNode parentNode, ref List <TreeNode> children)
        {
            var type = parentNode.Tag as TypeDef;

            foreach (TypeDef nestedType in type.NestedTypes.OrderBy(t => t.Name.ToLower()))
            {
                TreeNode newTypeNode = _treeViewHandler.NewType(nestedType);
                VirtualNodeUtilities.NewVirtualNode().AddTo(newTypeNode);

                children.Add(newTypeNode);
            }

            foreach (MethodDef method in type.Methods.OrderBy(m => m.Name.ToLower()))
            {
                List <MethodDef> accessorMethods = type.GetAccessorMethods();

                if (!accessorMethods.Contains(method))
                {
                    children.Add(_treeViewHandler.NewMethod(method));
                }
            }

            foreach (PropertyDef property in type.Properties.OrderBy(p => p.Name.ToLower()))
            {
                children.Add(_treeViewHandler.NewProperty(property));
            }

            foreach (FieldDef field in type.Fields.OrderBy(f => f.Name.ToLower()))
            {
                children.Add(_treeViewHandler.NewField(field));
            }

            foreach (EventDef @event in type.Events.OrderBy(e => e.Name.ToLower()))
            {
                children.Add(_treeViewHandler.NewEvent(@event));
            }
        }
Ejemplo n.º 3
0
 public void treeView1_AfterExpand(object sender, TreeViewEventArgs e)
 {
     VirtualNodeUtilities.ExpandHandler(e.Node, this);
 }