public override void Call() { if (IsCanceled) { _synchronizer.Redo(); return; } var path = Menu.GetUserInput("path:"); //@"C:\Users\Alexandr\Desktop\TEST"; var tager = new Tager(new FileLoader()); var analyzer = new Analyzer(tager, s => Path.GetExtension(s).ToLower() == ".mp3"); Menu.PrintHelp(); var mask = new Mask(Menu.GetUserInput("mask:")); analyzer.Analyze(Directory.GetFiles(path), mask); _synchronizer = new Synchronizer(tager,Menu.SelectSyncRule()); _synchronizer.Sync(analyzer.NotSynchronizedFiles.Keys, mask); Menu.PrintChanges(_synchronizer.ModifiedFiles); if (Menu.GetYesNoAnswer("Save changes?\nY/N:")) { _synchronizer.Save(); Menu.PrintMessage("Successfully"); Menu.PrintCollection(string.Format("with {0} errors", _synchronizer.ErrorFiles.Count), _synchronizer.ErrorFiles, ConsoleColor.Red); Menu.GetUserInput("Press enter..."); } }
public override void Call() { if (IsCanceled) { synchronizer.Redo(); return; } var path = Menu.GetUserInput("path:"); //@"C:\Users\Alexandr\Desktop\TEST\New folder"; var tager = new Tager(new FileLoader()); var analyzer = new Analyzer(tager, s => Path.GetExtension(s).ToLower() == ".mp3"); Menu.PrintHelp(); var mask = new Mask(Menu.GetUserInput("mask:")); analyzer.Analyze(Directory.GetFiles(path), mask); synchronizer = new Synchronizer(tager); foreach (var notSynchronizedFile in analyzer.NotSynchronizedFiles) { Console.Clear(); Menu.PrintMessage(notSynchronizedFile.Key.Name+" with "+notSynchronizedFile.Value); synchronizer.Sync(notSynchronizedFile.Key,mask,Menu.SelectSyncRule()); Menu.PrintChanges(notSynchronizedFile.Key); if (Menu.GetYesNoAnswer("Save changes?\nY/N:")) { try { synchronizer.SaveLast(); Menu.PrintMessage("Successfully"); Menu.GetUserInput("Press enter..."); } catch { Menu.PrintError("Can't save file"); } } else { synchronizer.RestoreLast(); } } }