public static bool SaveToStream(BinaryWriter outputWriter, Palette palette) { PaletteStorage storage = new PaletteStorage(string.Empty, palette); if (!storage.Write(outputWriter)) { Debug.Assert(false, "Cannot write a palette file!"); return(false); } return(true); }
public static bool SaveToFile(string filePath, Palette palette) { PaletteStorage storage = new PaletteStorage(filePath, palette); using (FileStream outputStream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) { using (BinaryWriter outputWriter = new BinaryWriter(outputStream, storage.Encoding)) { if (!storage.Write(outputWriter)) { Debug.Assert(false, "Cannot write a palette file!"); return(false); } } } return(true); }