コード例 #1
0
        /*
         * Now we can enumerate the input files.
         */
        protected IEnumerable <SplitPath> InputFiles()
        {
            var filtRegexes = FilterRegexes();
            var files       = from file in DirHelpers.Dir(_options.InputPath.BasePath, "*",
                                                          _options.Recursive)
                              let relPath = SplitPath.Split(_options.InputPath.BasePath, file)
                                            where filtRegexes.Any(re => re.IsMatch(relPath.FilePath))
                                            select relPath;

            return(IndicesFirst(files));
        }
コード例 #2
0
        /*
         * The mirror operation of defining an ID is making a token clickable by
         * surrounding it with an `<a>` tag. The target of the link is in the `href`
         * attribute, which is determined by the function below. The link consists
         * of the relative file path and the ID inside the file. The file path is
         * always used, even if the link target is inside the same file.
         */
        private string GetHrefForSymbol(ISymbol symbol)
        {
            var sref    = symbol.DeclaringSyntaxReferences.First();
            var reffile = SplitPath.Split(_options.InputPath.BasePath,
                                          sref.SyntaxTree.FilePath);
            var inputfile = SplitPath.Split(_options.InputPath.BasePath,
                                            _document.FilePath);

            return(Path.Combine(inputfile.RelativeFileRoot,
                                reffile.ChangeExtension("html").FilePath).Replace('\\', '/') +
                   "#" + GetSymbolId(symbol));
        }
コード例 #3
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));
        }