public PrcImages(Header header, PDBheader pdb) { m_FirstImageRec = header.ReadInt(108); // First image rec: Bytes 108-4 big-endian integer if (m_FirstImageRec > 0) { m_ImageArray = new ArrayList(); // Loop though images. Ignore last two records (FLIS and FCIS) for (int i = m_FirstImageRec; i < pdb.RecordCnt - 3; i++) { Image newImage; // get the next image Byte[] imageRec = pdb.GetRecord(i); // Check for various image formats (JPG,GIF,BMP etc) String jpgFlag = ReadString(imageRec, 6, 4); if (jpgFlag.Equals("JFIF")) { newImage = LoadJPEG(imageRec); m_ImageArray.Add(newImage); } String gifFlag = ReadString(imageRec, 0, 3); if (gifFlag.Equals("GIF")) { newImage = LoadGIF(imageRec); m_ImageArray.Add(newImage); } } } }
private void LoadPRC(string fn) { m_File = new FileStream(fn, FileMode.Open, FileAccess.Read); m_Array = new Byte[m_File.Length]; m_File.Read(m_Array, 0, m_Array.Length); Header m_Header = new Header(m_Array); m_PDBheader = new PDBheader(m_Header); byte[] prcRec = m_PDBheader.GetRecord(0); m_Rec0 = new Header(prcRec); m_PRCheader = new PRCheader(m_Rec0); m_MOBIheader = new MOBIheader(m_Rec0); // Does an EXTH header exist? Byte 126 bit 6 (0x40) bool m_EXTHexists = (((int)prcRec[126] & 0x40) == 0x00); if (m_EXTHexists) { m_EXTHheader = new EXTHheader(m_Rec0); } // Images m_Images = new PrcImages(m_Rec0, m_PDBheader); }