Exemplo n.º 1
0
        public blockStruct GetBlockStruct(byte[] buffs)
        {
            blockStruct struct2 = new blockStruct();
            int         offset  = 0;

            struct2.header_key    = (uint)GetInt32(4, ref offset, buffs);
            struct2.header_length = (uint)GetInt32(4, ref offset, buffs);
            struct2.decode_key    = (uint)GetInt32(4, ref offset, buffs);
            return(struct2);
        }
Exemplo n.º 2
0
        private string Getchapter(byte[] blockdata, int type)
        {
            blockStruct blockStruct = new blockStruct();
            GetData     data        = new GetData();

            blockStruct = new ByteToStructEbk3().GetBlockStruct(blockdata);
            byte[] buffer = new byte[blockStruct.header_length - 12];
            Array.Copy(blockdata, 12, buffer, 0, buffer.Length);
            blockinfoModel recodeBlockModel = this.GetRecodeBlockModel(this.ebk3_data.pbk_sys_data_decode(buffer, (int)blockStruct.decode_key), 11);

            if (recodeBlockModel.file_list_offset11 != 0)
            {
                byte[] buffer2 = new byte[blockdata.Length - recodeBlockModel.file_list_offset11];
                Array.Copy(blockdata, (int)recodeBlockModel.file_list_offset11, buffer2, 0, buffer2.Length);
            }
            byte[] buffer3 = new byte[4];
            Array.Copy(blockdata, (int)blockStruct.header_length, buffer3, 0, 4);
            int num  = (int)BitConverter.ToUInt32(this.ebk3_data.pbk_sys_data_decode(buffer3, (int)blockStruct.decode_key), 0);
            int num2 = (int)(blockStruct.header_length + 4);

            byte[] buffer4 = new byte[0x1400000];
            int    num3    = 0;
            int    num4    = 0;

            byte[] buffer5 = new byte[num * 4];
            Array.Copy(blockdata, num2, buffer5, 0, buffer5.Length);
            byte[] buffer6 = this.ebk3_data.pbk_sys_data_decode(buffer5, (int)blockStruct.decode_key);
            for (int i = 0; i < num; i++)
            {
                byte[] buffer7 = new byte[4];
                Array.Copy(buffer6, i * 4, buffer7, 0, 4);
                int    num6 = (int)BitConverter.ToUInt32(buffer7, 0);
                byte[] buff = new byte[num6];
                Array.Copy(blockdata, (num2 + (num * 4)) + num4, buff, 0, buff.Length);
                byte[] buffer9  = new byte[num6];
                byte[] buffer10 = DeCompress.Decompress(data.decodeingtext(buff, (int)blockStruct.decode_key));
                Array.Copy(buffer10, 0, buffer4, num3, buffer10.Length);
                num4 += num6;
                num3 += buffer10.Length;
            }
            byte[] bytes = new byte[num3];
            Array.Copy(buffer4, 0, bytes, 0, bytes.Length);
            if (type == 0)
            {
                return(Encoding.Unicode.GetString(bytes, 0, bytes.Length));
            }
            return(Encoding.Unicode.GetString(bytes, 0, bytes.Length));
        }
Exemplo n.º 3
0
        private string GetOneChapter(byte[] blockdata, int type, int mChapterIndex)
        {
            blockStruct blockStruct = new blockStruct();
            GetData     data        = new GetData();

            blockStruct = new ByteToStructEbk3().GetBlockStruct(blockdata);
            byte[] buffer = new byte[blockStruct.header_length - 12];
            Array.Copy(blockdata, 12, buffer, 0, buffer.Length);
            blockinfoModel recodeBlockModel = this.GetRecodeBlockModel(this.ebk3_data.pbk_sys_data_decode(buffer, (int)blockStruct.decode_key), 13);

            if (recodeBlockModel.file_list_offset11 != 0)
            {
                byte[] buffer2 = new byte[blockdata.Length - recodeBlockModel.file_list_offset11];
                Array.Copy(blockdata, (int)recodeBlockModel.file_list_offset11, buffer2, 0, buffer2.Length);
            }
            byte[] buffer3 = new byte[4];
            Array.Copy(blockdata, (int)blockStruct.header_length, buffer3, 0, 4);
            int num  = (int)BitConverter.ToUInt32(this.ebk3_data.pbk_sys_data_decode(buffer3, (int)blockStruct.decode_key), 0);
            int num2 = (int)(blockStruct.header_length + 4);

            byte[] buffer4 = new byte[num * 4];
            Array.Copy(blockdata, num2, buffer4, 0, buffer4.Length);
            byte[] buffer5 = this.ebk3_data.pbk_sys_data_decode(buffer4, (int)blockStruct.decode_key);
            uint   num3    = this.mChapterList[mChapterIndex].chapter_content_decompresss_offset5 / 0x10000;

            if (num3 > num)
            {
                return("");
            }
            int num4 = 0;
            int num5 = (int)(this.mChapterList[mChapterIndex].chapter_content_decompresss_offset5 % 0x10000);
            int num6 = 0;

            for (int i = 0; i < num3; i++)
            {
                byte[] buffer6 = new byte[4];
                Array.Copy(buffer5, i * 4, buffer6, 0, 4);
                num6  = (int)BitConverter.ToUInt32(buffer6, 0);
                num4 += num6;
            }
            byte[] buffer7 = new byte[4];
            Array.Copy(buffer5, (int)(num3 * 4), buffer7, 0, 4);
            num6 = (int)BitConverter.ToUInt32(buffer7, 0);
            byte[] buff = new byte[num6];
            Array.Copy(blockdata, (num2 + (num * 4)) + num4, buff, 0, buff.Length);
            byte[] buffer9  = new byte[num6];
            byte[] buffer10 = DeCompress.Decompress(data.decodeingtext(buff, (int)blockStruct.decode_key));
            byte[] bytes    = new byte[this.mChapterList[mChapterIndex].chapter_content_decompress_length6];
            string str      = "";

            if ((num5 + bytes.Length) < 0x10000)
            {
                Array.Copy(buffer10, num5, bytes, 0, bytes.Length);
            }
            else
            {
                Array.Copy(buffer10, num5, bytes, 0, 0x10000 - num5);
            }
            if ((num5 + this.mChapterList[mChapterIndex].chapter_content_decompress_length6) > 0x10000L)
            {
                num3++;
                if (num3 >= num)
                {
                    return("");
                }
                int num1 = ((int)(num5 + this.mChapterList[mChapterIndex].chapter_content_decompress_length6)) % 0x10000;
                num6 = 0;
                num4 = 0;
                for (int j = 0; j < num3; j++)
                {
                    byte[] buffer12 = new byte[4];
                    Array.Copy(buffer5, j * 4, buffer12, 0, 4);
                    num6  = (int)BitConverter.ToUInt32(buffer12, 0);
                    num4 += num6;
                }
                buffer7 = new byte[4];
                Array.Copy(buffer5, (int)(num3 * 4), buffer7, 0, 4);
                num6 = (int)BitConverter.ToUInt32(buffer7, 0);
                buff = new byte[num6];
                Array.Copy(blockdata, (num2 + (num * 4)) + num4, buff, 0, buff.Length);
                buffer9 = new byte[num6];
                Array.Copy(DeCompress.Decompress(data.decodeingtext(buff, (int)blockStruct.decode_key)), 0, bytes, 0x10000 - num5, bytes.Length - (0x10000 - num5));
            }
            if (type != 0)
            {
                str = Encoding.Unicode.GetString(bytes, 0, bytes.Length);
            }
            return(str);
        }