Esempio n. 1
0
        public void Generate(DocLibrary library, StringBuilder output)
        {
            output.AppendLine("# Library " + library.Name);
            output.AppendLine();

            output.AppendLine("## Namespaces");
            output.AppendLine();

            foreach (DocNamespace ns in library.Namespaces.OrderBy(ns => ns.Name))
            {
                GenerateTitle(ns, output);
            }

            output.AppendLine();

            foreach (DocNamespace ns in library.Namespaces.OrderBy(ns => ns.Name))
            {
                Generate(ns, output);
            }
        }
        public void Convert()
        {
            string libName = _xmlDoc.SelectSingleNode("//assembly/name").InnerText;

            log.Trace("extracting types...");
            ICollection <DocType> types = GetTypes();

            log.Trace("detecting namespaces...");
            ICollection <DocNamespace> namespaces = GetNamespaces(types);
            var lib = new DocLibrary {
                Name = libName, Namespaces = namespaces.ToArray()
            };

            Dictionary <string, LocationPin> entryToLocation = null;

            if (_sourceTreeBase != null)
            {
                SourceTree st = null;
                log.Trace("building source tree...");
                st = new SourceTree(_sourceTreeBase);
                entryToLocation = st.Build();
            }

            log.Trace("converting...");
            IOutputStyle style = new SinglePageOutputStyle(entryToLocation, _sourcePathBase);

            style.Generate(lib, _s);


            log.Trace("writing to file...");
            if (File.Exists(_outputFile))
            {
                File.Delete(_outputFile);
            }
            File.WriteAllText(_outputFile, _s.ToString());

            log.Trace("done.");
        }