Exemplo n.º 1
0
        /*
         * The second options is to use a solution as an input. In this case we
         * iterate markdown and C# source files separately, copying the MD files
         * and transforming the C# files.
         */
        protected override void GenerateFromSolution()
        {
            var solutionFile = MSBuildHelpers.OpenSolution(_options.Solution);

            foreach (var inputFile in MarkdownFilesInSolution(solutionFile))
            {
                CopyFile(inputFile);
            }
            foreach (var doc in CSharpDocumentsInSolution(solutionFile))
            {
                GenerateMarkdownFromCSharpDocument(doc.Item1, doc.Item2);
            }
        }
Exemplo n.º 2
0
        /*
         * And then we can gather the C# source files. Most of the heavy lifting is
         * delegated to the MSBuildHelper class. In addition to the file path we
         * return also the Document object that contains syntactic and semantic
         * information that the Roslyn compiler attaches to the source file.
         */
        protected IEnumerable <Tuple <SplitPath, Document> > CSharpDocumentsInSolution(
            SolutionFile solutionFile)
        {
            var workspace   = MSBuildWorkspace.Create();
            var solution    = workspace.OpenSolutionAsync(_options.Solution).Result;
            var filtRegexes = FilterRegexes();

            return(from proj in MSBuildHelpers.LoadProjectsInSolution(solution, solutionFile)
                   from doc in proj.Documents
                   let relPath = SplitPath.Split(_options.InputPath.BasePath, doc.FilePath)
                                 where filtRegexes.Any(re => re.IsMatch(relPath.FilePath))
                                 select Tuple.Create(relPath, doc));
        }
Exemplo n.º 3
0
        protected override void GenerateFromSolution()
        {
            var solution = MSBuildHelpers.OpenSolution(_options.Solution);

            foreach (var inputFile in MarkdownFilesInSolution(solution))
            {
                GenerateHtmlFromMarkdown(inputFile);
                AddToToc(inputFile);
            }
            foreach (var doc in CSharpDocumentsInSolution(solution))
            {
                GenerateHtmlFromCSharpDocument(doc.Item1, doc.Item2);
                AddToToc(doc.Item1);
            }
            ConsoleOut("Copying auxiliary HTML files...");
            _generateHtml.CopyAuxiliaryFiles();
            _tocManager.Save();
        }