Exemple #1
0
        public static TextStruct BytesToTextStruct(byte[] bytes)
        {
            TextStruct struct2 = new TextStruct();
            int        offset  = 0;

            struct2.book_id                   = GetInt32(4, ref offset, bytes);
            struct2.head_data_size            = GetInt16(2, ref offset, bytes);
            struct2.ebk_version               = GetInt16(2, ref offset, bytes);
            struct2.ebk_size                  = GetInt32(4, ref offset, bytes);
            struct2.book_name                 = GetBytes(0x40, ref offset, bytes);
            struct2.file_size                 = GetInt32(4, ref offset, bytes);
            struct2.head_compress_size        = GetInt32(4, ref offset, bytes);
            struct2.first_compress_block_size = GetInt32(4, ref offset, bytes);
            struct2.chapter_count             = GetInt16(2, ref offset, bytes);
            struct2.compress_block_count      = GetInt16(2, ref offset, bytes);
            struct2.media_count               = GetInt32(4, ref offset, bytes);
            struct2.media_data_length         = GetInt32(4, ref offset, bytes);
            struct2.txt_compress_size         = GetInt32(4, ref offset, bytes);
            return(struct2);
        }
        public static TextStruct BytesToTextStruct(byte[] bytes)
        {
            TextStruct result = default(TextStruct);
            int        num    = 0;

            result.book_id                   = BytesToStruct.GetInt32(4, ref num, bytes);
            result.head_data_size            = BytesToStruct.GetInt16(2, ref num, bytes);
            result.ebk_version               = BytesToStruct.GetInt16(2, ref num, bytes);
            result.ebk_size                  = BytesToStruct.GetInt32(4, ref num, bytes);
            result.book_name                 = BytesToStruct.GetBytes(64, ref num, bytes);
            result.file_size                 = BytesToStruct.GetInt32(4, ref num, bytes);
            result.head_compress_size        = BytesToStruct.GetInt32(4, ref num, bytes);
            result.first_compress_block_size = BytesToStruct.GetInt32(4, ref num, bytes);
            result.chapter_count             = BytesToStruct.GetInt16(2, ref num, bytes);
            result.compress_block_count      = BytesToStruct.GetInt16(2, ref num, bytes);
            result.media_count               = BytesToStruct.GetInt32(4, ref num, bytes);
            result.media_data_length         = BytesToStruct.GetInt32(4, ref num, bytes);
            result.txt_compress_size         = BytesToStruct.GetInt32(4, ref num, bytes);
            return(result);
        }