public FileRenamerPermitionsChecker(IFileRenamer fileRenamer, IPermitionsChecker permitionsChecker, Permitions userPermitions = Permitions.Guest) { this.fileRenamer = fileRenamer; this.permitionsChecker = permitionsChecker; this.userPermitions = userPermitions; }
public void Process(string[] args, MP3File[] files, Permitions userPermitions = Permitions.Guest) { if (files == null || files.Length == 0) { throw new ArgumentException("No files to process"); } ArgumentsParser parser = new ArgumentsParser(); Arguments arguments = parser.ParseArguments(args); foreach (var file in files) { string message = file.Path; IFileRenamer fileRenamer = new FileRenamer(); if (arguments.IsCheckPermitions) { IFileRenamer oldFileRenamer = fileRenamer; IPermitionsChecker checker = new PermitionsChecker(); fileRenamer = new FileRenamerPermitionsChecker(oldFileRenamer, checker, userPermitions); } if (arguments.IsTimeMeasure) { IFileRenamer oldFileRenamer = fileRenamer; fileRenamer = new FileRenamerTimeMeasure(oldFileRenamer); } fileRenamer.Rename(file); message += " successfully renamed to " + file.Path; if (arguments.IsTimeMeasure) { message += " in " + ((FileRenamerTimeMeasure)fileRenamer).ElapsedTime; } Console.WriteLine(message); } }
public bool Check(MP3File file, Permitions permitions) { return(file.FilePermitions <= permitions); }
public MP3File(string path, Permitions permitions) : this(path) { FilePermitions = permitions; }
public MP3File(string path) { Path = path; FilePermitions = Permitions.Guest; }