Exemple #1
0
        /*
         * Now we can enumerate the input files.
         */
        protected IEnumerable <SplitPath> InputFiles()
        {
            var filtRegexes = FilterRegexes();

            return(from file in DirHelpers.Dir(_options.InputPath.BasePath, "*", true)
                   let relPath = SplitPath.Split(_options.InputPath.BasePath, file)
                                 where filtRegexes.Any(re => re.IsMatch(relPath.FilePath))
                                 select relPath);
        }
        /*
         * 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.RelativePathToRoot,
                                reffile.ChangeExtension("html").FilePath).Replace('\\', '/') +
                   "#" + GetSymbolId(symbol));
        }
Exemple #3
0
        /*
         ### Enumerating Files in Solution
         ###When a solution file is used as an input, C# files are retrieved in a different way.
         ###They are enumerated using the Roslyn
         ###[workspace](https://github.com/dotnet/roslyn/wiki/Roslyn-Overview#working-with-a-workspace).
         */
        protected IEnumerable <Tuple <SplitPath, Document> > CSharpDocumentsInSolution()
        {
            var solution    = BuildSolution();
            var filtRegexes = FilterRegexes();

            return(from proj in CompileProjectsInSolution(solution)
                   from doc in proj.Documents
                   let relPath = SplitPath.Split(_options.InputPath.BasePath, doc.FilePath)
                                 where filtRegexes.Any(re => re.IsMatch(relPath.FilePath)) &&
                                 !(relPath.FilePath.EndsWith("AssemblyAttributes.cs") ||
                                   relPath.FilePath.EndsWith("AssemblyInfo.cs"))
                                 select Tuple.Create(relPath, doc));
        }