Exemple #1
0
bool MCF::fixMD5AndCRC()
{
	gcString empty("d41d8cd98f00b204e9800998ecf8427e");
	bool fixed = false;

	UTIL::FS::FileHandle handle;
	getReadHandle(handle);

	for (size_t x=0; x<m_pFileList.size(); x++)
	{
		if (m_pFileList[x]->isSaved() == false)
			continue;

		if (m_pFileList[x]->isCompressed() && empty == m_pFileList[x]->getCCsum())
		{
			fixed = true;
			m_pFileList[x]->generateMD5(handle);
		}

		fixed = true;
		m_pFileList[x]->generateCRC(handle);
	}	

	handle.close();

	if (fixed)
	{
		saveMCF_Header();
		return true;
	}

	return false;
}
Exemple #2
0
void MCF::makeCRC()
{
	printf("Making crc's\n");

	UTIL::FS::FileHandle hFile;
	getReadHandle(hFile);

	for (size_t x=0; x<m_pFileList.size(); x++)
	{
		if (!m_pFileList[x] || !m_pFileList[x]->isSaved())
			continue;

		m_pFileList[x]->generateCRC(hFile);
	}

	hFile.close();

	saveMCF_Header();
}
Exemple #3
0
void SMTController::postProcessing()
{
	if (m_uiNumber == 1)
		return;

	UTIL::FS::FileHandle fhSource;
	UTIL::FS::FileHandle fhSink;

	UTIL::FS::Path path(m_szFile, "", true);

	uint64 sinkSize = UTIL::FS::getFileSize(path);

	try
	{
		fhSink.open(path, UTIL::FS::FILE_APPEND);
	}
	catch (gcException &)
	{
		return;
	}

	char buff[BLOCKSIZE];

	for (size_t x=1; x<m_vWorkerList.size(); x++)
	{
		SMTWorkerInfo *worker = m_vWorkerList[x];

		uint64 fileSize = UTIL::FS::getFileSize(UTIL::FS::PathWithFile(worker->file));
		uint64 done = 0;

		uint32 readSize = BLOCKSIZE;

		try
		{
			fhSource.open(worker->file.c_str(), UTIL::FS::FILE_READ);
			while (fileSize > done)
			{
				if ((fileSize-done) < (uint64)readSize)
					readSize = (uint32)(fileSize-done);

				fhSource.read(buff, readSize);
				fhSink.write(buff, readSize);

				done += readSize;
			}
			fhSource.close();
		}
		catch (gcException &)
		{
		}

		for (size_t y=0; y<worker->vFileList.size(); y++)
		{
			uint32 index = worker->vFileList[y];
			MCFCore::MCFFile *temp = m_rvFileList[index];

			if (!temp)
				continue;

			temp->setOffSet( temp->getOffSet() + sinkSize );
		}

		sinkSize += fileSize;
		UTIL::FS::delFile(UTIL::FS::PathWithFile(worker->file));
	}

	if (m_bCreateDiff == false)
		return;
}