示例#1
0
 public DirectorySnippetExtractor(
     DirectoryFilter?directoryFilter = null,
     int maxWidth = int.MaxValue)
 {
     Guard.AgainstNegativeAndZero(maxWidth, nameof(maxWidth));
     this.maxWidth = maxWidth;
     fileFinder    = new SnippetFileFinder(directoryFilter);
 }
 public DirectorySnippetExtractor(
     DirectoryFilter?directoryFilter = null,
     int maxWidth   = int.MaxValue,
     string newLine = "\n")
 {
     Guard.AgainstNull(newLine, nameof(newLine));
     Guard.AgainstNegativeAndZero(maxWidth, nameof(maxWidth));
     this.newLine  = newLine;
     this.maxWidth = maxWidth;
     fileFinder    = new SnippetFileFinder(directoryFilter);
 }
示例#3
0
        public void AddSnippetsFrom(string directory)
        {
            directory = ExpandDirectory(directory);
            var finder = new SnippetFileFinder(directoryFilter);
            var files  = finder.FindFiles(directory);

            snippetSourceFiles.AddRange(files);
            log($"Searching {files.Count} files for snippets");
            var read = FileSnippetExtractor.Read(files, maxWidth).ToList();

            snippets.AddRange(read);
            log($"Added {read.Count} snippets");
        }