예제 #1
0
        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);
        }
예제 #2
0
        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);
        }