Ejemplo n.º 1
0
        /// <summary>
        /// Builds the specified assembly name.
        /// </summary>
        /// <param name="assemblyName">Name of the assembly.</param>
        /// <returns></returns>
        public NamespaceModel Build(string assemblyName)
        {
            var alternateName = GetAlternateName(assemblyName);
            var nm = new NamespaceModel {
                Name = assemblyName,
            };
            var exclude = this.GetType().Assembly;

            var xml = LoadXml(assemblyName);
            var NSIgnoreList = ConfigurationManager.AppSettings["site:NamespacesIgnoreList"].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            DocumentationAssemblies.Where(a => a != exclude &&
                    (a.GetName().Name.Equals(alternateName, StringComparison.InvariantCultureIgnoreCase) || a.GetName().Name.Equals(assemblyName, StringComparison.InvariantCultureIgnoreCase))
                ).ForEach(a => {
                a.GetTypes()
                    .Where(t => ((t.IsInNamespace(alternateName) || t.IsInNamespace(assemblyName)) || (t.IsInChildNamespace(alternateName) || t.IsInChildNamespace(assemblyName))) && !NSIgnoreList.Contains(t.Namespace))
                    .Select(t => t.Namespace)
                    .Distinct()
                    .ForEach(ns => {
                        if(string.IsNullOrWhiteSpace(nm.AssemblyVersion)) {
                            nm.AssemblyVersion = a.GetName().Version.ToString();
                        }
                        var processedNS = ProcessNamespace(ns, xml);
                        if(processedNS != null && processedNS.Classes.Count > 0) {
                            nm.Namespaces.Add(processedNS);
                        }
                    });
            });
            return nm;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Processes the namespace.
        /// </summary>
        /// <param name="namespace">The namespace.</param>
        /// <param name="xml">The XML.</param>
        /// <returns></returns>
        private NamespaceModel ProcessNamespace(string @namespace, XmlDocument xml)
        {
            var nm = new NamespaceModel {
                Name = @namespace
            };
            DocumentationAssemblies.ForEach(a => {
                var classes = new List<ClassModel>();
                a.GetTypes().Where(t => t.IsPublic && t.IsClass && t.IsInNamespace(@namespace)).ForEach(t => {
                    var pclass = ProcessType(t, xml);
                    nm.Classes.Add(pclass);
                });
            });

            return nm;
        }