コード例 #1
0
        void OrganizeNamespaces()
        {
            foreach (Assembly asm in CompilerParameters.References)
            {
                Type[] types = asm.GetTypes();
                foreach (Type type in types)
                {
                    string ns = type.Namespace;
                    if (null == ns)
                    {
                        ns = string.Empty;
                    }

                    string[] namespaceHierarchy        = ns.Split('.');
                    string   topLevelName              = namespaceHierarchy[0];
                    Bindings.NamespaceBinding topLevel = GetNamespaceBinding(topLevelName);
                    Bindings.NamespaceBinding current  = topLevel;
                    for (int i = 1; i < namespaceHierarchy.Length; ++i)
                    {
                        current = current.GetChildNamespace(namespaceHierarchy[i]);
                        // Trace(current);
                    }
                    current.Add(type);

                    List typeList = GetList(_externalTypes, type.FullName);
                    typeList.Add(type);
                }
            }
        }
コード例 #2
0
 Bindings.NamespaceBinding GetNamespaceBinding(string name)
 {
     Bindings.NamespaceBinding binding = (Bindings.NamespaceBinding)_namespaces[name];
     if (null == binding)
     {
         _namespaces[name] = binding = new Bindings.NamespaceBinding(BindingManager, name);
     }
     return(binding);
 }