Exemple #1
0
        public override MetadataItem VisitAssembly(IAssemblySymbol symbol)
        {
            var item = new MetadataItem
            {
                Name       = VisitorHelper.GetId(symbol),
                RawComment = symbol.GetDocumentationCommentXml(),
                Language   = Language,
            };

            item.DisplayNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.DisplayQualifiedNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.Type   = MemberType.Assembly;
            _references = new Dictionary <string, ReferenceItem>();
            var namespaces = symbol.GlobalNamespace.GetNamespaceMembers().ToList();

            if (namespaces.Count == 0)
            {
                Logger.LogWarning($"No namespace is found in assembly {symbol.MetadataName}. DocFX currently only supports generating metadata with namespace defined.");
            }

            item.Items = VisitDescendants(
                namespaces,
                ns => ns.GetMembers().OfType <INamespaceSymbol>(),
                ns => ns.GetMembers().OfType <INamedTypeSymbol>().Any(t => FilterVisitor.CanVisitApi(t)));
            item.References = _references;
            return(item);
        }
Exemple #2
0
        public override MetadataItem VisitAssembly(IAssemblySymbol symbol)
        {
            var item = new MetadataItem
            {
                Name       = VisitorHelper.GetId(symbol),
                RawComment = symbol.GetDocumentationCommentXml(),
                Language   = Language,
            };

            item.DisplayNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.DisplayQualifiedNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.Type   = MemberType.Assembly;
            _references = new Dictionary <string, ReferenceItem>();
            item.Items  = VisitDescendants(
                symbol.GlobalNamespace.GetNamespaceMembers(),
                ns => ns.GetMembers().OfType <INamespaceSymbol>(),
                ns => ns.GetMembers().OfType <INamedTypeSymbol>().Any(t => VisitorHelper.CanVisit(t)));
            item.References = _references;
            return(item);
        }
Exemple #3
0
        /// <summary>
        /// Prepares the <see cref="AssemblyMemberBuilder"/> from the <paramref name="symbol"/>
        /// and adds it to <see cref="RootMember.Assemblies"/>
        /// </summary>
        /// <param name="symbol">Source <see cref="IAssemblySymbol"/></param>
        /// <param name="root">Builder root</param>
        /// <param name="level">Hierarchy level (used to indent the console output)</param>
        private static void BuildAssembly(IAssemblySymbol symbol, RootMemberBuilder root, int level)
        {
            var a = new AssemblyMemberBuilder
            {
                Name             = symbol.Name,
                NameBase         = symbol.Name,
                Symbol           = symbol,
                DocumentationId  = symbol.GetDocumentationCommentId(),
                DocumentationXml = symbol.GetDocumentationCommentXml()
            };

            root.Assemblies.Add(a);
            Console.WriteLine($"{new string(' ', level)} read as {a}");
            // ReSharper disable once TailRecursiveCall
            Build(symbol.GlobalNamespace, root, a, null, null, level + 1);
        }
Exemple #4
0
        public override MetadataItem VisitAssembly(IAssemblySymbol symbol)
        {
            var item = new MetadataItem
            {
                Name        = symbol.GetRawId(),
                RawComment  = symbol.GetDocumentationCommentXml(),
                DisplayName = symbol.MetadataName,
                Type        = MemberType.Assembly,
            };

            var namespaces = symbol.GlobalNamespace.GetNamespaceMembers();

            item.Items = VisitDescendants(
                namespaces,
                ns => ns.GetMembers().OfType <INamespaceSymbol>(),
                ns => ns.GetMembers().OfType <INamedTypeSymbol>().Any(t => ApiFilter.CanVisitApi(t))
                );
            return(item);
        }
Exemple #5
0
        public override MetadataItem VisitAssembly(IAssemblySymbol symbol)
        {
            var item = new MetadataItem
            {
                Name       = VisitorHelper.GetId(symbol),
                RawComment = symbol.GetDocumentationCommentXml(),
                Language   = Language,
            };

            item.DisplayNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.DisplayQualifiedNames = new SortedList <SyntaxLanguage, string>
            {
                { SyntaxLanguage.Default, symbol.MetadataName },
            };
            item.Type   = MemberType.Assembly;
            _references = new Dictionary <string, ReferenceItem>();

            var typeMembers = symbol.GlobalNamespace.GetTypeMembers();

            if (typeMembers.Any())
            {
                Logger.LogWarning($"DocFX currently only supports generating metadata with namespace defined. The following types in assembly \"{symbol.MetadataName}\" will have no metadata generated: {string.Join(", ", typeMembers.Select(m => m.MetadataName))}. ");
            }

            var namespaces = symbol.GlobalNamespace.GetNamespaceMembers().ToList();

            item.Items = VisitDescendants(
                namespaces,
                ns => ns.GetMembers().OfType <INamespaceSymbol>(),
                ns => ns.GetMembers().OfType <INamedTypeSymbol>().Any(t => FilterVisitor.CanVisitApi(t)));
            item.References = _references;
            return(item);
        }