public override void Read(string fileIn) { BinaryReader br = new BinaryReader(File.OpenRead(fileIn)); br.ReadChars(4); // MAP\0 uint map_size = br.ReadUInt32(); br.BaseStream.Position = 0x10; int width = br.ReadUInt16(); int height = br.ReadUInt16(); int tile_width = br.ReadUInt16(); int tile_height = br.ReadUInt16(); if (tile_height != tile_width) { System.Windows.Forms.MessageBox.Show("Tile dimension doesn't agree!\nWidth:" + tile_width.ToString() + " Height: " + tile_height.ToString()); } width *= tile_width; height *= tile_height; br.BaseStream.Position = 0x20; NTFS[] map = new NTFS[(map_size - 0x20) / 2]; for (int i = 0; i < map.Length; i++) { map[i] = Actions.MapInfo(br.ReadUInt16()); map[i].nPalette = 0; } // Get the IMY data br.BaseStream.Position = map_size; byte[] imy = br.ReadBytes((int)(br.BaseStream.Length - map_size)); br.Close(); string imy_file = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName(); File.WriteAllBytes(imy_file, imy); // Read the file new IMY(pluginHost, imy_file, id, fileName); // Change some image parameters ImageBase img = pluginHost.Get_Image(); int tile_size = tile_width * tile_height * img.BPP / 8; // Set a zero tile in the beggining byte[] newTiles = new byte[img.Tiles.Length + tile_size]; Array.Copy(img.Tiles, 0, newTiles, tile_size, img.Tiles.Length); img.Set_Tiles(newTiles); img.TileSize = tile_width; img.FormTile = TileForm.Horizontal; pluginHost.Set_Image(img); Set_Map(map, false, width, height); pluginHost.Set_Map(this); }