protected void RestoreFile() { var newMemento = _file.GetMemento(); _file.SetMemento(_memento); _memento = newMemento; _file.Save(); }
public void Save() { if (_currentFile == null) { throw new NullReferenceException("File is not loaded"); } _currentFile.Save(); }
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); } } }