Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public TypeInfoCollections(IEnumerable <Assembly> assemblies)
 {
     foreach (Assembly a in assemblies)
     {
         _byAssembly.Add(new AssemblyTreeNode(a));
     }
     ByNamespace = new TypeInfoNsTreeNode(assemblies);
 }
Exemplo n.º 3
0
        public TypeInfoNsTreeNode GetRoot()
        {
            TypeInfoNsTreeNode current = this;

            while (current.Parent != null && current.Parent is TypeInfoNsTreeNode)
            {
                current = (TypeInfoNsTreeNode)(current.Parent);
            }
            return(current);
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 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));
     }
 }
Exemplo n.º 6
0
 public AssemblyTreeNode(Assembly assembly)
 {
     _assembly = assembly;
     NsRoot    = new TypeInfoNsTreeNode(this);
 }
Exemplo n.º 7
0
 private TypeInfoNsTreeNode(string name, TypeInfoNsTreeNode parent)
 {
     Name   = name;
     Parent = parent;
     parent._innerList.Add(this);
 }