private async Task ProcessFile(string path, IFileTransform transformation) { try { if (await transformation.Process(path)) { transformation.Success(path); } else { transformation.Failed(path); } } catch (Exception error) { _logger.Error(error); transformation.Failed(path); } }
public async Task Transform(string root, IFileTransform transformation) { var walker = new FileFinder(_fileSystem); var tasks = walker.Walk(root, transformation.Matches).Select(path => ProcessFile(path, transformation)).ToList(); await Task.WhenAll(tasks); }