Пример #1
0
        // Finds the node associated with this member
        internal static MemberTreeNode FindMember(MemberInfo member)
        {
            Type     type = member.DeclaringType;
            Assembly assy = type.Assembly;

            AssemblyTreeNode assyNode =
                AssemblySupport.FindAssemblyNode(assy);

            if (assyNode == null)
            {
                return(null);
            }

            NamespaceTreeNode nameNode =
                assyNode.FindNamespace(type.Namespace);

            if (nameNode == null)
            {
                return(null);
            }

            TypeTreeNode typeNode =
                nameNode.FindType(type);

            if (typeNode == null)
            {
                return(null);
            }

            return(typeNode.FindMemberNode(member, !TypeTreeNode.FIND_NESTED));
        }
Пример #2
0
        internal static void AddAssy(Assembly assy, ICollection types)
        {
            lock (_assemblies) {
                // Don't add unless the tab is visible, because
                // the GetTypes() can take a long time (up to 10
                // seconds in some cases)
                bool controlTreeShowing = ComponentInspectorProperties.ShowControlPanel;
                if (!controlTreeShowing) {
                    _uptodate = false;
                    return;
                }

                // Keep track of the assemblies we know about, don't
                // add the same one twice
                if (_assemblies[assy] == null)
                    _assemblies.Add(assy, assy);
                else
                    return;
            }

            if (types == null)
                types = AssemblySupport.GetAssyTypes(assy);

            foreach (Type t in types) {
                if (!(typeof(Control).IsAssignableFrom(t)))
                    continue;
                
                String ns = t.Namespace;
                if (ns == null)
                    ns = "";
                
                bool found = false;
                NamespaceTreeNode n = null;
                for (int i = 0; i < _controlTree.Nodes.Count; i++) {
                    n = (NamespaceTreeNode)_controlTree.Nodes[i];
                    if (n.Namespace.Equals(ns)) {
                        found = true;
                        n.InvalidateNode();
                        break;
                    }
                }

                if (!found) {
                    n = new NamespaceTreeNode(ns);
                    _controlTree.Nodes.Add(n);
                }

                n.AddAssy(assy);
            }
        }