public void Save(string filename) { if (!string.IsNullOrEmpty(filename)) { FileInfo = new FileInfo(filename); } var hpiFilename = FileInfo.FullName; var hpbFilename = FileInfo.FullName.Remove(FileInfo.FullName.Length - 1) + "B"; // Save As... if (!string.IsNullOrWhiteSpace(filename)) { _hpihpb.Save(File.Create(hpiFilename), File.Create(hpbFilename)); _hpihpb.Close(); } else { // Create the temp files _hpihpb.Save(File.Create(hpiFilename + ".tmp"), File.Create(hpbFilename + ".tmp")); _hpihpb.Close(); // Delete the originals FileInfo.Delete(); File.Delete(hpbFilename); // Rename the temporary files File.Move(hpiFilename + ".tmp", hpiFilename); File.Move(hpbFilename + ".tmp", hpbFilename); } // Reload the new file to make sure everything is in order Load(FileInfo.FullName); }
public void Unload() { _hpihpb?.Close(); }