public void write(Writer writer)
        {
            // Palettes
            stagePalette.write(writer);

            // SpriteSheets
            writer.Write((byte)spriteSheets.Count);
            foreach (string sheet in spriteSheets)
            {
                writer.writeRSDKString(sheet);
            }

            // Objects
            writer.Write((byte)objects.Count);
            foreach (ObjectInfo info in objects)
            {
                writer.Write(info.script);
            }

            foreach (ObjectInfo info in objects)
            {
                writer.Write((byte)info.sheetID);
            }

            // SoundFX
            writer.Write((byte)soundFX.Count);
            foreach (string path in soundFX)
            {
                writer.writeRSDKString(path);
            }

            // Music
            writer.Write((byte)musicTracks.Count);
            foreach (string track in musicTracks)
            {
                writer.writeRSDKString(track);
            }

            writer.Close();
        }
        public void write(Writer writer)
        {
            var    fileStream = writer.BaseStream as FileStream;
            string filename   = fileStream.Name;

            // Write Tile Layout

            // Write width and height
            writer.Write(width);
            writer.Write(height);

            // Write tile layout
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    writer.Write(layout[y][x]);
                }
            }

            // Close map file
            writer.Close();

            // Write Object layout
            Writer ITMwriter = new Writer(Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + ".itm");

            // Save zone name
            ITMwriter.writeRSDKString(title);

            // Write the Stage Init Data
            ITMwriter.Write((byte)initialMusicID);
            ITMwriter.Write((byte)initialBackgroundID);
            ITMwriter.Write((byte)(playerSpawnX >> 8));
            ITMwriter.Write((byte)(playerSpawnX & 0xFF));
            ITMwriter.Write((byte)(playerSpawnY >> 8));
            ITMwriter.Write((byte)(playerSpawnY & 0xFF));

            // Write number of entities
            ITMwriter.Write((byte)(entities.Count >> 8));
            ITMwriter.Write((byte)(entities.Count & 0xFF));

            // Write entities
            foreach (Entity entity in entities)
            {
                entity.write(ITMwriter);
            }

            ITMwriter.Close();
        }
        public void write(Writer writer, bool dcVer = false)
        {
            writer.Write(unknown); //No idea what this is
            writer.Write((byte)playerType);
            writer.Write((byte)animations.Count);

            // SpriteSheets
            for (int s = 0; s < (dcVer ? 2 : 3); ++s)
            {
                writer.writeRSDKString(spriteSheets[s]);
            }

            // Animations
            foreach (AnimationEntry anim in animations)
            {
                anim.write(writer);
            }

            writer.Close();
        }
 public void write(Writer writer)
 {
     writer.writeRSDKString(directory);
     writer.Write(startOffset);
 }