public override bool OpenIlb(string fileName, List <AoWBitmap> imageList)
        {
            using (FileStream fs = File.OpenRead(fileName))
            {
                BinaryReader br = new BinaryReader(fs);

                UInt32 dword;
                // check magic number
                dword = br.ReadUInt32();
                if (dword != AoW1HeaderV4.ilbIdentifier)
                {
                    return(false);
                }

                // unknown1
                dword = br.ReadUInt32();
                Trace.WriteLine(string.Format("Header unknown1 0x{0:X}", dword));
                // float version
                float version = br.ReadSingle();
                Trace.WriteLine(string.Format("Header version {0}", version));
                // Logger.LogMessage(MsgLevel.DEBUG, string.Format("Header version {0}", version));
                Debug.WriteLine(string.Format("Header version {0}", version));
                if (version == AoW1HeaderV3.VERSION)
                {
                    AoW1HeaderV3 header = new AoW1HeaderV3();
                    header.Read(br, imageList);
                }
                else if (version == AoW1HeaderV4.VERSION)
                {
                    AoW1HeaderV4 header = new AoW1HeaderV4();
                    header.Read(br, imageList);
                }
                else
                {
                    throw new Exception(string.Format("Unsupported ilb version ({0})", version));
                }
            }
            return(true);
        }         // end OpenIlb
        }         // end OpenIlb

        public override bool MakeIlb(string fileName, List <AoWBitmap> imageList)
        {
            AoWBitmap first     = null;
            AoWBitmap first8bbp = null;

            foreach (AoWBitmap elem in imageList)
            {
                if (elem != null)
                {
                    if (first == null)
                    {
                        first = elem;
                    }
                    if (elem.Resized.PixelFormat == PixelFormat.Format8bppIndexed)
                    {
                        first8bbp = elem;
                        break;
                    }
                }
            }
            if (first == null)
            {
                return(false);
            }

            try
            {
                using (MemoryStream tempMemory = new MemoryStream())
                {
                    using (MemoryStream imageMemory = new MemoryStream())
                    {
                        BinaryWriter tempStream  = new BinaryWriter(tempMemory);
                        BinaryWriter imageStream = new BinaryWriter(imageMemory);

                        // set the number of palettes (0 - 1 for this editor):
                        UInt32 nrOfPalettes = first8bbp != null ? 1u : 0u;
                        // write the palette
                        if (nrOfPalettes > 0)
                        {
                            // write the type of palette (always RGB):
                            tempStream.Write(0x88801B18);
                            ColorPalette palette = first8bbp.Resized.Palette;
                            foreach (Color c in palette.Entries)
                            {
                                tempStream.Write((Byte)c.R);
                                tempStream.Write((Byte)c.G);
                                tempStream.Write((Byte)c.B);
                                tempStream.Write((Byte)0);
                            }
                            // be sure to write 256 entries
                            for (int i = palette.Entries.Length; i < 256; ++i)
                            {
                                tempStream.Write(0);
                            }
                        }

                        // Write image info data and bitmap data to separate streams:
                        int imageNumber = 0;
                        foreach (AoWBitmap elem in imageList)
                        {
                            if (elem != null)
                            {
                                if (elem.ImageNumber != imageNumber)
                                {
                                    elem.ImageNumber = imageNumber;
                                }
                                elem.WriteImage(tempStream, imageStream);
                            }
                            ++imageNumber;
                        }
                        tempStream.Write(0xFFFFFFFF);                         // End description section

                        AoW1HeaderV4 header = new AoW1HeaderV4();
                        // guess this may be true
                        header.unknown1        = (nrOfPalettes > 0) ? 0x0040DB00u : 0x0040F000u;
                        header.imageDataOffset = header.length + 4u + (UInt32)tempStream.BaseStream.Length;
                        header.ilbFileSize     = header.imageDataOffset + (UInt32)imageStream.BaseStream.Length;
                        header.numPalette      = nrOfPalettes;

                        using (FileStream fs = new FileStream(fileName, FileMode.Create))
                        {
                            BinaryWriter bw = new BinaryWriter(fs);

                            // Assemble the library file:
                            // First: header record ...
                            header.Write(bw);

                            // Second: palettes and image info data ...
                            tempMemory.WriteTo(fs);
                            // Finally: image bitmap data ...
                            imageMemory.WriteTo(fs);

                            // Logger.LogMessage(MsgLevel.INFO, string.Format("{0} - Made. ({1})", Path.GetFileName(fileName), fileName));
                            Debug.WriteLine(string.Format("{0} - Made. ({1})", Path.GetFileName(fileName), fileName));
                            return(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Logger.LogMessage(MsgLevel.FAULT, ex.Message);
                //Logger.LogMessage(MsgLevel.FAULT, string.Format("{0} - Failure. ({1})", Path.GetFileName(fileName), fileName));
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(string.Format("{0} - Failure. ({1})", Path.GetFileName(fileName), fileName));
            }
            return(false);
        }