private String GetDocument() { // Extract the document StringBuilder doc = new StringBuilder(m_PRCheader.TextLenth + 2); Decompression decoder = null; switch (m_PRCheader.Compression) { case PRCheader.CompressionMode.None: decoder = new Decompression(); break; case PRCheader.CompressionMode.PalmDoc: decoder = new LZ77decompress(); break; case PRCheader.CompressionMode.Huffman: //decoder = new HuffmanDecompress(m_Rec0); break; default: throw new Exception("Invalid compression"); } for (int i = 1; i < m_MOBIheader.FirstImageRec; i++) { byte[] bo = GetRecord(i); doc.Append(decoder.Decompress(bo)); } return(doc.ToString()); }
public String DecompressRecord(int recnum) { Decompression decoder = null; switch (m_PRCheader.Compression) { case PRCheader.CompressionMode.None: decoder = new Decompression(); break; case PRCheader.CompressionMode.PalmDoc: decoder = new LZ77decompress(); break; case PRCheader.CompressionMode.Huffman: //decoder = new HuffmanDecompress(m_Rec0); break; default: throw new Exception("Invalid compression"); } Byte[] bo = GetRecord(recnum); return(decoder.Decompress(bo)); }