Beispiel #1
0
        public void ChoosingMode()
        {
            BackupFolder mainFloder = new BackupFolder();

            int mode = 0;

            do
            {
                ShowModes();
                mode = ReadSelectedMode();

                switch (mode)
                {
                case 1:
                    Watcher watcher = new Watcher();
                    watcher.Run(mainFloder.Info.FullName);
                    break;

                case 2:
                    BackupControls backupControls = new BackupControls();
                    backupControls.SuggestAndMakeRestore();
                    break;

                default:
                    Console.WriteLine("{0}Работа с приложением завершена!", Environment.NewLine);
                    break;
                }
            } while (mode != 3);
        }
Beispiel #2
0
        public Dictionary <DateTime, List <FileData> > GetDictionaryFromJson()
        {
            JsonAdapter <BackupsLog> jsonAdapter = new JsonAdapter <BackupsLog>();
            BackupFolder             mainFloder  = new BackupFolder();
            BackupsLog backupsLog = jsonAdapter.ReadFromJsonFile() ?? new BackupsLog();

            return(backupsLog.BackupsLogDictionary);
        }
Beispiel #3
0
        public JsonAdapter()
        {
            BackupFolder mainFloder = new BackupFolder();

            Path = System.IO.Path.Combine(mainFloder.Info.FullName, "Log.json");

            if (!File.Exists(Path))
            {
                File.Create(Path).Close();
            }
        }
Beispiel #4
0
        private void CommitNewChanges()
        {
            try
            {
                BackupFolder    backupFolder = new BackupFolder();
                List <FileData> bacupsList   = backupFolder.TxtFiles;

                _backupsLog.AddChangesToDictionary(DateTime.Now, bacupsList);

                JsonAdapter <BackupsLog> jsonAdapter = new JsonAdapter <BackupsLog>();
                jsonAdapter.SaveToJsonFile(_backupsLog);
            }
            catch (Exception ex)
            {
                Console.WriteLine("The process failed: {0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace);
            }
        }
Beispiel #5
0
 public BackupControls()
 {
     GetBackupsDictionary();
     _backupfolder = new BackupFolder();
 }