public static NamespaceInfo AddType(Type type) { lock (namespaces) { NamespaceInfo _namespace; if (!namespaces.TryGetValue(type.Namespace, out _namespace)) { _namespace = new NamespaceInfo(type.Namespace); namespaces.Add(type.Namespace, _namespace); } if (!_namespace.namespaceTypes.Contains(type)) { _namespace.namespaceTypes.Add(type); } return(_namespace); } }
private void BuildNamespace(string requestedNS, TreeNodeCollection nodes) { ICollection <NamespaceInfo> list; NamespaceInfo ns; if (requestedNS == "_root") { list = ReflectionHelper.Namespaces; foreach (NamespaceInfo info in list) { TreeNodeBase treeNode; if (info.NamespaceTypes.Count == 0) { treeNode = new TreeNode(); treeNode.Leaf = true; } else { treeNode = new AsyncTreeNode(); treeNode.SingleClickExpand = true; } treeNode.Text = this.Context.Server.HtmlEncode(info.NamespaceName); //treeNode.NodeID = "ns:"+info.FullName; treeNode.CustomAttributes.Add(new ConfigItem("marker", "ns:" + info.NamespaceName, ParameterMode.Value)); treeNode.IconCls = "namespace-icon"; nodes.Add(treeNode); } nodes.Sort((x, y) => x.Text.CompareTo(y.Text)); } else { ns = NamespaceInfo.GetByName(requestedNS); if (ns != null) { foreach (Type type in ns.NamespaceTypes) { this.AddType(type, nodes, true); } } nodes.Sort((x, y) => x.Text.CompareTo(y.Text)); } }