Exemplo n.º 1
0
        public void Render(NamespaceApiView ns, StringListApiView list, int indents = 0)
        {
            var builder           = new StringBuilder();
            var isGlobalNamespace = ns.Name == "<global namespace>";

            if (!isGlobalNamespace && ns.NamedTypes.Any())
            {
                AppendIndents(builder, indents);
                RenderKeyword(builder, "namespace");
                builder.Append(" ");
                RenderCommentable(builder, ns.Id, ns.Name);
                builder.Append(" {");
                list.Add(new LineApiView(builder.ToString(), ns.Id));
            }

            foreach (NamedTypeApiView nt in ns.NamedTypes)
            {
                Render(nt, list, indents + 1);
            }

            if (!isGlobalNamespace && ns.NamedTypes.Any())
            {
                builder = new StringBuilder();
                AppendIndents(builder, indents);
                builder.Append("}");
                list.Add(new LineApiView(builder.ToString()));
            }

            foreach (NamespaceApiView n in ns.Namespaces)
            {
                Render(n, list, indents);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Construct a new AssemblyApiView instance, represented by the provided symbol.
 /// </summary>
 /// <param name="symbol">The symbol representing the assembly.</param>
 public AssemblyApiView(IAssemblySymbol symbol)
 {
     this.Name            = symbol.Name;
     this.GlobalNamespace = new NamespaceApiView(symbol.GlobalNamespace);
 }