public void Save(string filename) { if (!string.IsNullOrEmpty(filename)) { FileInfo = new FileInfo(filename); } // Save As... if (!string.IsNullOrEmpty(filename)) { _sarc.Save(FileInfo.Create()); _sarc.Close(); } else { // Create the temp file _sarc.Save(File.Create(FileInfo.FullName + ".tmp")); _sarc.Close(); // Delete the original FileInfo.Delete(); // Rename the temporary file File.Move(FileInfo.FullName + ".tmp", FileInfo.FullName); } // Reload the new file to make sure everything is in order Load(FileInfo.FullName); }
public SaveResult Save(string filename) { SaveResult result = SaveResult.Success; if (!string.IsNullOrEmpty(filename)) { FileInfo = new FileInfo(filename); } try { _sarc.Save(FileInfo.Create()); } catch { result = SaveResult.Failure; } return(result); }