public override void Read(BinaryReader br, List <AoWBitmap> imageList) { // length of this header UInt32 dword = br.ReadUInt32(); if (dword != length) { throw new Exception(string.Format("Wrong header v3 length ({0})", dword)); } numPalette = br.ReadUInt32(); Debug.Assert(numPalette == 0); // read info data AoWBitmap model = PersistentData.Data.AoW1Default; AoWBitmap elem = null; while (true) { elem = new AoW1Bitmap(model); if (!elem.ReadImageInfo(br)) { // End description section Debug.Assert(elem.ImageNumber == -1); // 0xFFFFFFFF); break; } // be sure there is enough space while (elem.ImageNumber >= imageList.Count) { imageList.Add(null); } imageList[elem.ImageNumber] = elem; } // no ReadImageData, because header v3 should have no distinct sections }
public override void Read(BinaryReader br, List <AoWBitmap> imageList) { // length of this header UInt32 dword = br.ReadUInt32(); if (dword != length) { throw new Exception(string.Format("Wrong header v4 length ({0})", dword)); } imageDataOffset = br.ReadUInt32(); ilbFileSize = br.ReadUInt32(); Trace.WriteLine(string.Format("Ilb File Size {0}", ilbFileSize)); numPalette = br.ReadUInt32(); List <ColorPalette> palettes = new List <ColorPalette>(); for (UInt32 i = 0; i < numPalette; ++i) { palettes.Add(ReadPalette(br)); } Trace.WriteLine(string.Format("Read {0} palettes", palettes.Count)); // Logger.LogMessage(MsgLevel.DEBUG, string.Format("Ilb contains {0} palettes", palettes.Count)); Debug.WriteLine(string.Format("Ilb contains {0} palettes", palettes.Count)); // read info data AoWBitmap model = PersistentData.Data.AoW1Default; AoWBitmap elem = null; while (true) { elem = new AoW1Bitmap(model); if (!elem.ReadImageInfo(br)) { // End description section if (elem.ImageNumber == -1) // 0xFFFFFFFF); { break; } else { // read a blank image probably br.ReadUInt32(); // throw away next dword continue; } } // be sure there is enough space while (elem.ImageNumber >= imageList.Count) { imageList.Add(null); } imageList[elem.ImageNumber] = elem; } foreach (AoWBitmap elem1 in imageList) { if (elem1 != null) { elem1.ReadImageData(br, palettes); } } }