Пример #1
0
        /// <summary>
        /// List all files present in the directory (matching the mask, if given)
        /// </summary>
        private List <string> discoverFiles()
        {
            var masks = _settings.Masks ?? DirectorySourceSettings.DefaultMasks; // (new[] { "*.*" });

            var contentDirectory = ContentDirectory;

            // Add files present in the content directory
            var filePaths = new List <string>();

            // [WMR 20170817] NEW
            // Safely enumerate files in specified path and subfolders, recursively
            filePaths.AddRange(safeGetFiles(contentDirectory, masks, _settings.IncludeSubDirectories));

            var includes = Includes;

            if (includes?.Length > 0)
            {
                var includeFilter = new FilePatternFilter(includes);
                filePaths = includeFilter.Filter(contentDirectory, filePaths).ToList();
            }

            var excludes = Excludes;

            if (excludes?.Length > 0)
            {
                var excludeFilter = new FilePatternFilter(excludes, negate: true);
                filePaths = excludeFilter.Filter(contentDirectory, filePaths).ToList();
            }

            return(filePaths);
        }
Пример #2
0
        // IMPORTANT!
        // prepareFiles & prepareSummaries callers MUST lock on _syncLock

        /// <summary>
        /// Prepares the source by reading all files present in the directory (matching the mask, if given)
        /// </summary>
        private List <string> prepareFiles()
        {
            var filePaths = _artifactFilePaths;

            if (filePaths != null)
            {
                return(filePaths);
            }

            var masks = _settings.Masks ?? (new[] { "*.*" });

            // Add files present in the content directory
            filePaths = new List <string>();

            // [WMR 20170817] NEW
            // Safely enumerate files in specified path and subfolders, recursively
            filePaths.AddRange(safeGetFiles(_contentDirectory, masks, _settings.IncludeSubDirectories));

            var includes = Includes;

            if (includes?.Length > 0)
            {
                var includeFilter = new FilePatternFilter(includes);
                filePaths = includeFilter.Filter(_contentDirectory, filePaths).ToList();
            }

            var excludes = Excludes;

            if (excludes?.Length > 0)
            {
                var excludeFilter = new FilePatternFilter(excludes, negate: true);
                filePaths = excludeFilter.Filter(_contentDirectory, filePaths).ToList();
            }

            _artifactFilePaths   = filePaths;
            _artifactSummaries   = null;
            _roArtifactSummaries = null;
            return(filePaths);
        }