コード例 #1
0
        public recordIndex  readIndex(byte[] data, ref int i)
        {
            recordIndex pIndex = new recordIndex();

            if (!BitConverter.IsLittleEndian)
            {
                pIndex.dwOffset = Utils.BytesToUInt(EndianSwap(data, i, 4)); i += 4;
                pIndex.wMagic   = Utils.BytesToUInt16(EndianSwap(data, i, 2)); i += 2;
                pIndex.wFlags   = Utils.BytesToUInt16(EndianSwap(data, i, 2)); i += 2;
                pIndex.time_t   = Utils.BytesToUInt(EndianSwap(data, i, 4)); i += 4;
            }
            else
            {
                pIndex.dwOffset = Utils.BytesToUInt(data, i); i += 4;
                pIndex.wMagic   = Utils.BytesToUInt16(data, i); i += 2;
                pIndex.wFlags   = Utils.BytesToUInt16(data, i); i += 2;
                pIndex.time_t   = Utils.BytesToUInt(data, i); i += 4;
            }
            pIndex.sUUID = UUIDfromLLUUID(data, ref i);
            if (!BitConverter.IsLittleEndian)
            {
                pIndex.wType  = Utils.BytesToUInt16(EndianSwap(data, i, 2)); i += 2;
                pIndex.dwSize = Utils.BytesToUInt(EndianSwap(data, i, 4), 0); i += 4;
            }
            else
            {
                pIndex.wType  = Utils.BytesToUInt16(data, i); i += 2;
                pIndex.dwSize = Utils.BytesToUInt(data, i); i += 4;
            }
            return(pIndex);
        }
コード例 #2
0
        public SLCacheIndexRead(byte[] cacheindexdata)
        {
            int IndexCount = (cacheindexdata.Length / 34);
            int i          = 0;

            SLCacheRecordIndex = new recordIndex[IndexCount];

            // deserialize the number of record in the index.
            for (int iter = 0; iter < IndexCount; iter++)
            {
                recordIndex inex = readIndex(cacheindexdata, ref i);
                SLCacheRecordIndex[iter] = inex;
            }
        }