Example #1
0
        /// <summary>Reads the namespaces.</summary>
        /// <returns>The <see cref="List{T}"/>.</returns>
        public List <AssemblyScope.AssemblyScope> ReadNamespaces()
        {
            // Add all namespaces
            var namespacePaths = TypesUtil.GetNamespaces(Assembly.Location, Blacklist.Namespaces);
            var assemblyScopes = new List <AssemblyScope.AssemblyScope>();

            foreach (string namespaceData in namespacePaths)
            {
                var split = namespaceData.Split(Path.DirectorySeparatorChar, NamespaceData.NamespacePathSeparator);

                // Breaks up the dn into a name member and namespace only
                string typeName = split[split.Length - 1];

                // Construct namespace path
                StringBuilder namespaceTextBuilder = new StringBuilder();
                int           maxNamespaces        = split.Length - 1;

                for (var i = 0; i < maxNamespaces; i++)
                {
                    if (i != 0)
                    {
                        if (i == maxNamespaces - 1)
                        {
                            namespaceTextBuilder.Append($@"{split[i]}");
                        }
                        else
                        {
                            // Add namespaces
                            namespaceTextBuilder.Append($@"{split[i]}.");
                        }
                    }
                }

                string namespacePath = namespaceTextBuilder.ToString();
                assemblyScopes.Add(new AssemblyScope.AssemblyScope(Assembly.Location, namespacePath, typeName));
            }

            if ((Blacklist.Types != null) && (Blacklist.Types.Count > 0))
            {
                foreach (string blackListItem in Blacklist.Types)
                {
                    int unused = assemblyScopes.RemoveAll(x => x.FullName.ToString().Equals(blackListItem));
                }
            }

            return(assemblyScopes);
        }