public T Execute <T>(IFileExecutable <T> command) { if (!Directory.Exists(_path)) { throw new Exception("invalid path: " + _path); } foreach (var file in Directory.EnumerateFileSystemEntries(_path, "", _recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).ToHashSet()) { command.Execute(file); } return(command.Result); }
internal FileCommand(FileWorker fileWorker, IFileExecutable <T> executable, IResulter?resulter = null) { _fileWorker = fileWorker; _executable = executable; _resulter = resulter; }
public static ICommand CreateFileCommand <T>(string path, bool isRecursive, IFileExecutable <T> executable, IResulter?resulter) { return(new FileCommand <T>(new FileWorker(path, isRecursive), executable, resulter)); }
public static ICommand CreateFileCommand <T>(FileWorker fileWorker, IFileExecutable <T> executable, IResulter?resulter) { return(new FileCommand <T>(fileWorker, executable, resulter)); }