示例#1
0
        public byte[] infomodelarray(ChapterListModel infomodel, int key)
        {
            Ebk3_Data data = new Ebk3_Data();

            object[]             objArray = new object[infomodel.chaptermodellenth];
            ChapterListByteModel model    = new ChapterListByteModel {
                chapter_index1     = BitConverter.GetBytes(infomodel.chapter_index1),
                chapter_level2     = BitConverter.GetBytes(infomodel.chapter_level2),
                chapter_data_type3 = BitConverter.GetBytes(infomodel.chapter_data_type3)
            };

            byte[] bytes = BitConverter.GetBytes(infomodel.chapter_data_block_offset4);
            model.chapter_data_block_offset4          = data.pbk_sys_data_encode(bytes, key);
            model.chapter_content_decompresss_offset5 = BitConverter.GetBytes(infomodel.chapter_content_decompresss_offset5);
            model.chapter_content_decompress_length6  = BitConverter.GetBytes(infomodel.chapter_content_decompress_length6);
            model.chapter_name_length7 = BitConverter.GetBytes(infomodel.chapter_name_length7);
            byte[] buffer2 = Encoding.Unicode.GetBytes(infomodel.chapter_name_data8);
            model.chapter_name_data8 = data.pbk_sys_data_encode(buffer2, key);
            objArray[0] = model.chapter_name_length7;
            objArray[1] = model.chapter_index1;
            objArray[2] = model.chapter_level2;
            objArray[3] = model.chapter_data_type3;
            objArray[4] = model.chapter_data_block_offset4;
            objArray[5] = model.chapter_content_decompresss_offset5;
            objArray[6] = model.chapter_content_decompress_length6;
            objArray[7] = model.chapter_name_data8;
            byte[] buffer3 = new byte[0x19000];
            int    num     = 0;

            for (int i = 0; i < objArray.Length; i++)
            {
                byte[] buffer4 = objArray[i] as byte[];
                Array.Copy(buffer4, 0, buffer3, num, buffer4.Length);
                num += buffer4.Length;
            }
            byte[] buffer5 = new byte[num];
            Array.Copy(buffer3, 0, buffer5, 0, buffer5.Length);
            return(buffer5);
        }
示例#2
0
        public byte[] GetEbk3HeadData(EBK3HeadInfoModel infomodel, uint time)
        {
            EBK3HeadStruct struct2 = new EBK3HeadStruct();

            new Model();
            GetEbk3HeadArray array = new GetEbk3HeadArray();
            Ebk3_Data        data  = new Ebk3_Data();

            byte[] buffer = new byte[4];
            Encoding.UTF8.GetBytes("EBK3").CopyTo(buffer, 0);
            struct2.identifier = buffer;
            struct2.header_key = 0;
            struct2.decode_key = time;
            object[] infomodellist = array.infomodelarray(infomodel);
            byte[]   recodeByte    = this.GetRecodeByte(infomodellist);
            byte[]   buffer3       = data.pbk_sys_data_encode(recodeByte, (int)struct2.decode_key);
            struct2.header_length = (uint)(0x10 + recodeByte.Length);
            byte[] buffer4 = new byte[struct2.header_length];
            byte[] buffer5 = Ebk3Make.StrucTObytes(struct2);
            Array.Copy(buffer5, 0, buffer4, 0, buffer5.Length);
            Array.Copy(buffer3, 0, buffer4, buffer5.Length, buffer3.Length);
            return(buffer4);
        }