ResFile::size_t CResReaderBase<File_Version_1_0>::GetDataLen( const char* pFileName, size_t& nPos ) { nPos = Find(pFileName); if ( nPos == Invaild_Pos ) { return 0; } const FileHead::TDataIndex& DataIndex = m_pFileHead->DataIndex[nPos]; DWORD dwDataPos = DataIndex.dwOffset; DataHead Head; GetDataHead(dwDataPos, Head); return Head.dwRawDataLen; }
unsigned int CResReaderBase<File_Version_1_0>::ReadInfoThread() { DataHead Head; for ( size_t i = 0; i < m_pFileHead->dwFileCount && !m_bEndThread; ++i ) { const FileHead::TDataIndex& DataIndex = m_pFileHead->DataIndex[i]; DWORD dwDataPos = DataIndex.Info.dwDataOffset; GetDataHead(dwDataPos, Head); m_pInfoReadCallback->OnInfoRead( i, (eEncryptAlgo)Head.nEncryptAlgo, (eCompressAlgo)Head.nCompressAlgo, (eCompressParam)Head.nCompressLevel, Head.dwRawDataLen ); } return 0; }
bool PushData(void* pData, unsigned int nLen) { if (nDataPos+nLen >= nMaxSize) { return false; } DATAHEAD* pTempDataHead = GetDataHead(); if (NULL == pTempDataHead) { return false; } // ??????? pTempDataHead->pHead = (pDataMem+nDataPos); pTempDataHead->nLen = nLen; pTempDataHead->pNext = NULL; // ???? memcpy(pDataMem+nDataPos, pData, nLen); nDataPos += nLen; if (NULL == pListDataHead) { pListDataHead = pTempDataHead; pCurDataHead = pTempDataHead; return true; } else { pCurDataHead->pNext = pTempDataHead; pCurDataHead = pCurDataHead->pNext; return true; } }