/// <summary> /// Saves the file to the specified stream. /// </summary> /// <param name="stream">The stream to save to.</param> public override void Save(Stream stream) { BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR")); writer.Write(Width); writer.Write(Height); for (int h = Height - 1; h >= 0; h--) { for (int w = 0; w < Width; w++) { TilePatch tile = tiles[h, w]; writer.Write(tile.Brush); writer.Write(tile.TileIndex); writer.Write(tile.TileSet); writer.Write(tile.Tile); } } }
/// <summary> /// Saves the file to the specified stream. /// </summary> /// <param name="stream">The stream to save to.</param> public override void Save(Stream stream) { BinaryWriter writer = new BinaryWriter(stream, CodePagesEncodingProvider.Instance.GetEncoding("EUC-KR")); writer.Write(Width); writer.Write(Height); for (int y = Height - 1; y >= 0; y--) { for (int x = 0; x < Width; x++) { TilePatch tile = tiles[y, x]; writer.Write(tile.Brush); writer.Write(tile.TileIndex); writer.Write(tile.TileSet); writer.Write(tile.Tile); } } }
/// <summary> /// Loads the file from the specified stream. /// </summary> /// <param name="stream">The stream to read from.</param> public override void Load(Stream stream) { BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR")); int width = reader.ReadInt32(); int height = reader.ReadInt32(); tiles = new TilePatch[height, width]; for (int h = height - 1; h >= 0; h--) { for (int w = 0; w < width; w++) { TilePatch tile = new TilePatch(); tile.Brush = reader.ReadByte(); tile.TileIndex = reader.ReadByte(); tile.TileSet = reader.ReadByte(); tile.Tile = reader.ReadInt32(); tiles[h, w] = tile; } } }
/// <summary> /// Loads the file from the specified stream. /// </summary> /// <param name="stream">The stream to read from.</param> public override void Load(Stream stream) { BinaryReader reader = new BinaryReader(stream, CodePagesEncodingProvider.Instance.GetEncoding("EUC-KR")); int width = reader.ReadInt32(); int height = reader.ReadInt32(); tiles = new TilePatch[height, width]; for (int y = height - 1; y >= 0; y--) { for (int x = 0; x < width; x++) { TilePatch tile = new TilePatch(); tile.Brush = reader.ReadByte(); tile.TileIndex = reader.ReadByte(); tile.TileSet = reader.ReadByte(); tile.Tile = reader.ReadInt32(); tiles[y, x] = tile; } } }