Exemple #1
0
        void ReadTrailer(MbmBinaryReader input)
        {
            // Seek to trailer
            UInt32 lastPos = input.Tell();

            input.Seek(header.trailerOff);

            UInt32 count = input.ReadUInt32();

            if (count > MaxBitmapCount || count == 0)
            {
                String message = String.Format("Bitmap count in MBM file doesn't make sense ({0}). " +
                                               "It should not be equal to 0 and must not be larger than {1}", count, MaxBitmapCount);

                throw new MbmException(message);
            }

            trailer = new MbmTrailer(count);

            for (UInt32 i = 0; i < count; i++)
            {
                trailer.Add(input.ReadUInt32());
            }

            input.Seek(lastPos);
        }
Exemple #2
0
        void ReadHeader(MbmBinaryReader input)
        {
            UInt32 uid1 = input.ReadUInt32();
            UInt32 uid2 = input.ReadUInt32();
            UInt32 uid3 = input.ReadUInt32();

            if (uid1 != MbmHeader.directFileStoreUIDNum || uid2 != MbmHeader.multiBitmapUIDNum)
            {
                throw new MbmException("UID1 and UID2 of MBM header has invalid value!");
            }

            // No need for the uid1 and uid2 anymore
            UInt32 uidChecksum   = input.ReadUInt32();
            UInt32 trailerOffset = input.ReadUInt32();

            header = new MbmHeader(new UID(uid3), trailerOffset);
        }
Exemple #3
0
        SBMHeader ReadSingleBitmapHeader(MbmBinaryReader input, UInt32 offset)
        {
            SBMHeader bitmapHeader = new SBMHeader();

            // Seek to trailer
            UInt32 lastPos = input.Tell();

            input.Seek(offset);

            bitmapHeader.bitmapSize   = input.ReadUInt32();
            bitmapHeader.headerLength = input.ReadUInt32();
            bitmapHeader.sizeInPixel  = input.ReadSize();
            bitmapHeader.sizeInTwips  = input.ReadSize();
            bitmapHeader.bitsPerPixel = input.ReadUInt32();
            bitmapHeader.colorMode    = (BitmapColor)input.ReadUInt32();
            bitmapHeader.paletteSize  = input.ReadUInt32();
            bitmapHeader.compression  = (BitmapCompression)input.ReadUInt32();

            input.Seek(lastPos);

            return(bitmapHeader);
        }