예제 #1
0
        public TypeInfoNsTreeNode GetNs(string ns)
        {
            TypeInfoNsTreeNode currentNode = GetRoot();

            if (String.IsNullOrEmpty(ns))
            {
                return(currentNode);
            }
            string[] names = ns.Split('.');
            for (int i = 0; i < names.Length; i++)
            {
                TypeInfoNsTreeNode node = currentNode._innerList.OfType <TypeInfoNsTreeNode>().FirstOrDefault(n => n.Name == names[i]);
                if (node != null)
                {
                    currentNode = node;
                }
                else
                {
                    for (int n = 0; n < names.Length; n++)
                    {
                        currentNode = new TypeInfoNsTreeNode(names[n], currentNode);
                    }
                }
            }
            return(currentNode);
        }
예제 #2
0
 public TypeInfoCollections(IEnumerable <Assembly> assemblies)
 {
     foreach (Assembly a in assemblies)
     {
         _byAssembly.Add(new AssemblyTreeNode(a));
     }
     ByNamespace = new TypeInfoNsTreeNode(assemblies);
 }
예제 #3
0
        public TypeInfoNsTreeNode GetRoot()
        {
            TypeInfoNsTreeNode current = this;

            while (current.Parent != null && current.Parent is TypeInfoNsTreeNode)
            {
                current = (TypeInfoNsTreeNode)(current.Parent);
            }
            return(current);
        }
예제 #4
0
 public TypeInfoNsTreeNode(IEnumerable <Assembly> assemblies)
 {
     Name   = "";
     Parent = null;
     foreach (Type type in assemblies.SelectMany(a => a.GetExportedTypes()))
     {
         TypeInfoNsTreeNode node = GetNs(type.Namespace);
         node._innerList.Add(new TypeInfoTreeNode(type, node));
     }
 }
예제 #5
0
 public TypeInfoNsTreeNode(AssemblyTreeNode parent)
 {
     Name   = "";
     Parent = parent;
     foreach (Type type in parent.GetAssembly().GetExportedTypes())
     {
         TypeInfoNsTreeNode node = GetNs(type.Namespace);
         node._innerList.Add(new TypeInfoTreeNode(type, node));
     }
 }
예제 #6
0
 public AssemblyTreeNode(Assembly assembly)
 {
     _assembly = assembly;
     NsRoot    = new TypeInfoNsTreeNode(this);
 }
예제 #7
0
 private TypeInfoNsTreeNode(string name, TypeInfoNsTreeNode parent)
 {
     Name   = name;
     Parent = parent;
     parent._innerList.Add(this);
 }