コード例 #1
0
        /// <summary>
        /// Decodes a block of url-string data
        /// </summary>
        /// <param name="dataBlock">block of data</param>
        /// <param name="nOffset">current file offset</param>
        /// <returns>true if succeeded</returns>
        private bool DecodeBlock(byte[] dataBlock, ref int nOffset)
        {
            bool bRet        = true;
            int  blockOffset = nOffset;

            MemoryStream memStream = new MemoryStream(dataBlock);
            BinaryReader binReader = new BinaryReader(memStream);

            for (int i = 0; i < RECORDS_PER_BLOCK; i++)
            {
                int recordOffset = blockOffset + (int)memStream.Position;

                uint nuniqueID    = (uint)binReader.ReadInt32();               // unknown dword
                int  ntopicsIdx   = binReader.ReadInt32();
                int  urlstrOffset = binReader.ReadInt32();

                UrlTableEntry newEntry = new UrlTableEntry(nuniqueID, recordOffset, ntopicsIdx, urlstrOffset, _associatedFile);
                _urlTable.Add(newEntry);

                if (memStream.Position >= memStream.Length)
                {
                    break;
                }
            }

            if (dataBlock.Length == BLOCK_SIZE)
            {
                binReader.ReadInt32();
            }

            return(bRet);
        }
コード例 #2
0
        /// <summary>
        /// Reads the object data from a dump store
        /// </summary>
        /// <param name="reader">reader to read the data</param>
        internal void ReadDump(ref BinaryReader reader)
        {
            int i    = 0;
            int nCnt = reader.ReadInt32();

            for (i = 0; i < nCnt; i++)
            {
                UrlTableEntry newItem = new UrlTableEntry();
                newItem.SetCHMFile(_associatedFile);
                newItem.ReadDump(ref reader);
                _urlTable.Add(newItem);
            }
        }