Exemplo n.º 1
0
            public override void LoadNextLevel(TreeNodeAssemblyView parentNode)
            {
                TreeNodeAssemblyType at = parentNode as TreeNodeAssemblyType;

                parentNode.Nodes.Add(new TreeNodeProperties(at.ExportedType));
                parentNode.Nodes.Add(new TreeNodeMethods(at.ExportedType));
                parentNode.Nodes.Add(new TreeNodeEvents(at.ExportedType));
            }
Exemplo n.º 2
0
            public override void LoadNextLevel(TreeNodeAssemblyView parentNode)
            {
                TreeNodeAssembly tna = parentNode as TreeNodeAssembly;
                SortedList <string, TreeNode> nodes = new SortedList <string, TreeNode>();
                Assembly a = tna.LoadedAssembly;

                Type[] tps = a.GetExportedTypes();
                for (int i = 0; i < tps.Length; i++)
                {
                    bool b = tps[i].IsPublic;
                    if (b)
                    {
                        TreeNodeAssemblyType n;
                        if (tps[i].IsEnum)
                        {
                            n = new TreeNodeEnumType(tps[i]);
                        }
                        else
                        {
                            n = new TreeNodeAssemblyType(tps[i]);
                        }
                        if (nodes.ContainsKey(n.Text))
                        {
                            uint mx = 2;
                            while (true)
                            {
                                string nm = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", n, Text, mx.ToString("x", CultureInfo.InvariantCulture));
                                if (nodes.ContainsKey(nm))
                                {
                                    mx++;
                                }
                                else
                                {
                                    nodes.Add(nm, n);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            nodes.Add(n.Text, n);
                        }
                    }
                }
                IEnumerator <KeyValuePair <string, TreeNode> > ie = nodes.GetEnumerator();

                while (ie.MoveNext())
                {
                    parentNode.Nodes.Add(ie.Current.Value);
                }
            }
Exemplo n.º 3
0
            public override void LoadNextLevel(TreeNodeAssemblyView parentNode)
            {
                TreeNodeAssemblyType at = parentNode as TreeNodeAssemblyType;
                Type t = at.ExportedType;

                EventInfo[] pifs = t.GetEvents();
                for (int i = 0; i < pifs.Length; i++)
                {
                    if (!pifs[i].IsSpecialName)
                    {
                        parentNode.Nodes.Add(new TreeNodeEvent(pifs[i]));
                    }
                }
            }
Exemplo n.º 4
0
            public override void LoadNextLevel(TreeNodeAssemblyView parentNode)
            {
                TreeNodeAssemblyType at = parentNode as TreeNodeAssemblyType;
                Type  t  = at.ExportedType;
                Array ss = Enum.GetValues(t);

                if (ss != null)
                {
                    for (int i = 0; i < ss.Length; i++)
                    {
                        parentNode.Nodes.Add(new TreeNodeEnumValue(t, ss.GetValue(i)));
                    }
                }
            }
Exemplo n.º 5
0
        public void LoadGac(params string[] namespaceAndType)
        {
            string _namespace = null;
            string _typename  = null;

            if (namespaceAndType != null)
            {
                if (namespaceAndType.Length > 0)
                {
                    _namespace = namespaceAndType[0];
                    if (namespaceAndType.Length > 1)
                    {
                        _typename = namespaceAndType[1];
                    }
                }
            }
            List <TreeNodeAssembly> traFound = new List <TreeNodeAssembly>();

            lblInfo.Location = new System.Drawing.Point(
                (this.Width - lblInfo.Width) / 2, (this.Height - lblInfo.Height) / 2);
            lblInfo.Visible = true;
            lblInfo.Refresh();
            List <string> ss = new List <string>();

            AssemblyCacheEnum ace = new AssemblyCacheEnum(null);
            string            s;

            s = ace.GetNextAssembly();
            while (!string.IsNullOrEmpty(s))
            {
                ss.Add(s);
                s = ace.GetNextAssembly();
            }
            ss.Sort(new Comparison <string>(compareStringNoCase));
            if (manualDlls != null)
            {
                foreach (KeyValuePair <string, Assembly> s0 in manualDlls)
                {
                    Nodes.Add(new TreeNodeAssembly(s0.Key, s0.Value));
                }
            }
            for (int i = 0; i < ss.Count; i++)
            {
                TreeNodeAssembly tra = new TreeNodeAssembly(ss[i]);
                Nodes.Add(tra);
                if (!string.IsNullOrEmpty(_namespace))
                {
                    if (ss[i].StartsWith(_namespace, StringComparison.Ordinal))
                    {
                        traFound.Add(tra);
                    }
                }
            }
            if (traFound.Count > 0)
            {
                this.SelectedNode = traFound[0];
            }
            if (!string.IsNullOrEmpty(_typename))
            {
                foreach (TreeNodeAssembly tra in traFound)
                {
                    tra.Expand();
                    bool b = false;
                    for (int i = 0; i < tra.Nodes.Count; i++)
                    {
                        TreeNodeAssemblyType n = tra.Nodes[i] as TreeNodeAssemblyType;
                        if (n != null)
                        {
                            if (string.CompareOrdinal(n.ExportedType.FullName, _typename) == 0)
                            {
                                this.SelectedNode = n;
                                b = true;
                                break;
                            }
                        }
                        if (b)
                        {
                            break;
                        }
                    }
                }
            }
            lblInfo.Visible = false;
        }