Пример #1
0
        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());
        }
Пример #2
0
        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));
        }