Пример #1
0
 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);
 }
Пример #2
0
 internal FileCommand(FileWorker fileWorker, IFileExecutable <T> executable, IResulter?resulter = null)
 {
     _fileWorker = fileWorker;
     _executable = executable;
     _resulter   = resulter;
 }
Пример #3
0
 public static ICommand CreateFileCommand <T>(string path, bool isRecursive, IFileExecutable <T> executable,
                                              IResulter?resulter)
 {
     return(new FileCommand <T>(new FileWorker(path, isRecursive), executable, resulter));
 }
Пример #4
0
 public static ICommand CreateFileCommand <T>(FileWorker fileWorker, IFileExecutable <T> executable,
                                              IResulter?resulter)
 {
     return(new FileCommand <T>(fileWorker, executable, resulter));
 }