Save() public method

public Save ( ) : void
return void
Exemplo n.º 1
0
        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...");
            }
        }
Exemplo n.º 2
0
        public override void Call()
        {
            if (IsCanceled)
            {
                _synchronizer.Redo();
                return;
            }

            var path = Menu.GetUserInput("Load your plan\npath:");
            var planLoader = new PlanProvider();
            var tager = new Tager(new FileLoader());

            _synchronizer = new Synchronizer(tager);
            _synchronizer.Sync(planLoader.Load(path));

            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...");
            }
        }