private static async IAsyncEnumerable <string> RecurseDirectory(
            ShareDirectoryClient directory,
            IPathFilter pathFilter,
            [EnumeratorCancellation] CancellationToken cancellationToken)
        {
            var directoryPath = directory.Path;

            await foreach (var item in directory.GetFilesAndDirectoriesAsync(cancellationToken: cancellationToken))
            {
                var nextPath       = $"{directoryPath}{(directoryPath == "" ? "" : "/")}{item.Name}";
                var nextPathAction = pathFilter.DecideAction(nextPath);

                if (item.IsDirectory && nextPathAction == PathAction.Recurse)
                {
                    var subDirectory = directory.GetSubdirectoryClient(item.Name);

                    await foreach (var subItem in RecurseDirectory(subDirectory, pathFilter, cancellationToken))
                    {
                        yield return(subItem);
                    }
                }
                else if (nextPathAction == PathAction.Collect)
                {
                    yield return(nextPath);
                }
            }
        }
 public IAsyncEnumerable <string> ListAsync(IPathFilter pathFilter, CancellationToken cancellationToken)
 {
     if (pathFilter == null)
     {
         throw new ArgumentNullException(nameof(pathFilter));
     }
     return(RecurseDirectory(_shareClient.GetRootDirectoryClient(), pathFilter, cancellationToken));
 }
Пример #3
0
 public override bool IsMatch(string rootFolder, string path)
 {
     if (m_filter == null)
     {
         m_filter = new WildCardPathFilter(m_pattern);
     }
     return(m_filter.IsMatch(rootFolder, path));
 }
Пример #4
0
        public SourceCode(IVersionControlSystem versionControlSystem)
        {
            VersionControlSystem = versionControlSystem;
            _getAll = new Lazy <IEnumerable <string> >(() => VersionControlSystem.SourceCode.Select(FileSystem.NormalizedPath));
            _getAllButCodecovIgnored = new Lazy <IEnumerable <string> >(LoadGetAllButCodecovIgnored);
            _directory = new Lazy <string>(() => VersionControlSystem.RepoRoot);

            _fileFilter = BuildSourceFilter();
        }
Пример #5
0
        public ABPackageMst(ArgsLine arg)
        {
            PathPattern = arg.GetSingle("-filter");
            PackName    = arg.GetSingle("-name");
            if (int.TryParse(arg.GetSingle("-priority"), out var num))
            {
                Priority = num;
            }
            Labels = arg.GetMulti("-label").ToArray();

            Identifier = PathPattern;

            PathFilter = new WildCardPathFilter(PathPattern);
            Converter  = GetConverter(config: PackName);
        }
Пример #6
0
 public PathFilterExpression(IPathFilter include, IPathFilter exclude = null)
 {
     this.include = include ?? throw new ArgumentNullException(nameof(include));
     this.exclude = exclude ?? PathFilter.MatchNone;
 }
 public SsrsDataSetDataSourceReferenceRewriter(IPathFilter existingReferenceFilter, string replacementReference)
 {
     ExistingReferenceFilter = existingReferenceFilter ?? throw new ArgumentNullException(nameof(existingReferenceFilter));
     ReplacementReference    = replacementReference ?? throw new ArgumentNullException(nameof(replacementReference));
 }