Пример #1
0
        protected void RestoreFile()
        {
            var newMemento = _file.GetMemento();

            _file.SetMemento(_memento);
            _memento = newMemento;

            _file.Save();
        }
Пример #2
0
 public void Save()
 {
     if (_currentFile == null)
     {
         throw new NullReferenceException("File is not loaded");
     }
     _currentFile.Save();
 }
Пример #3
0
        private void SaveMp3File(IMp3File mp3File, bool enableBackup)
        {
            if (!enableBackup)
            {
                mp3File.Save();
                return;
            }

            var backup = new FileBackuper(mp3File);
            using (backup)
            {
                try
                {
                    mp3File.Save();
                }
                catch (Exception e)
                {
                    backup.RestoreFromBackup();
                    throw new Exception("File " + mp3File.FullName
                        + " was restored from backup because of exception:", e);
                }
            }
        }
Пример #4
0
        private void SaveMp3File(IMp3File mp3File, bool enableBackup)
        {
            if (!enableBackup)
            {
                mp3File.Save();
                return;
            }

            var backup = new FileBackuper(mp3File);

            using (backup)
            {
                try
                {
                    mp3File.Save();
                }
                catch (Exception e)
                {
                    backup.RestoreFromBackup();
                    throw new Exception("File " + mp3File.FullName
                                        + " was restored from backup because of exception:", e);
                }
            }
        }