Exemplo n.º 1
0
        public static bool UnmarshalLzxcResetTable(ref byte[] pData, ref uint pDataPos,
                                                   ref uint pDataLen, ref chmLzxcResetTable dest)
        {
            /* we only know how to deal with a 0x28 byte structures */
            if (pDataLen != CHM_LZXC_RESETTABLE_V1_LEN)
            {
                return(false);
            }

            /* unmarshal fields */
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.version);
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.block_count);
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.unknown);
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.table_offset);
            Unmarshal.ToUInt64(ref pData, ref pDataPos, ref pDataLen, ref dest.uncompressed_len);
            Unmarshal.ToUInt64(ref pData, ref pDataPos, ref pDataLen, ref dest.compressed_len);
            Unmarshal.ToUInt64(ref pData, ref pDataPos, ref pDataLen, ref dest.block_len);

            /* check structure */
            if (dest.version != 2)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public static bool UnmarshalLzxcResetTable(ref byte[] pData, ref uint pDataPos, 
            ref uint pDataLen, ref chmLzxcResetTable dest)
        {
            /* we only know how to deal with a 0x28 byte structures */
            if (pDataLen != CHM_LZXC_RESETTABLE_V1_LEN)
                return false;

            /* unmarshal fields */
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.version);
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.block_count);
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.unknown);
            Unmarshal.ToUInt32(ref pData, ref pDataPos, ref pDataLen, ref dest.table_offset);
            Unmarshal.ToUInt64(ref pData, ref pDataPos, ref pDataLen, ref dest.uncompressed_len);
            Unmarshal.ToUInt64(ref pData, ref pDataPos, ref pDataLen, ref dest.compressed_len);
            Unmarshal.ToUInt64(ref pData, ref pDataPos, ref pDataLen, ref dest.block_len);

            /* check structure */
            if (dest.version != 2)
                return false;

            return true;
        }