mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
feat: fast hash checker
This commit is contained in:
@@ -16,6 +16,7 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
|
||||
this->commonClientHandler = commonClientHandler;
|
||||
this->dataParser = dataParser;
|
||||
this->assetManager = assetManager;
|
||||
hashCalculator = new FastHashCalculator;
|
||||
|
||||
if (!QDir(staticDataFolderName).exists())
|
||||
{
|
||||
@@ -87,12 +88,21 @@ void UpdateController::showHash()
|
||||
void UpdateController::calculateFullHash()
|
||||
{
|
||||
Logger::instance().log("Calculate hash...");
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
qDebug() << "Start calculate... ";
|
||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
|
||||
auto *list = calculateHash(buildPath);
|
||||
//auto *list = calculateHash(buildPath);
|
||||
|
||||
hashCalculator->calculateHashes(buildPath);
|
||||
auto* list = hashCalculator->getHashList();
|
||||
qDebug() << "Hash count: " << list->count();
|
||||
saveHash(buildHashName,list);
|
||||
calculateSharedHash();
|
||||
Logger::instance().log("Calculate hash complete");
|
||||
qDebug() << "Calculate time " << timer.elapsed();
|
||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
|
||||
|
||||
}
|
||||
|
||||
void UpdateController::calculateFullHashWithSetup()
|
||||
@@ -451,6 +461,7 @@ void UpdateController::calculateSharedHash()
|
||||
|
||||
while (dirIterator.hasNext())
|
||||
{
|
||||
fileList->clear();
|
||||
dirIterator.next();
|
||||
QFileInfo fileInfo = dirIterator.fileInfo();
|
||||
if (fileInfo.fileName() == "." || fileInfo.fileName() == "..")
|
||||
@@ -458,7 +469,10 @@ void UpdateController::calculateSharedHash()
|
||||
|
||||
QString fileName = Tools::createVersionHashFilepath(fileInfo.fileName());
|
||||
|
||||
fileList = calculateHash(fileInfo.absoluteFilePath());
|
||||
hashCalculator->calculateHashes(fileInfo.filePath());
|
||||
fileList = hashCalculator->getHashList();
|
||||
//fileList = calculateHash(fileInfo.absoluteFilePath());
|
||||
qDebug() << "Hash count: " << fileList->count();
|
||||
saveHash(fileName,fileList);
|
||||
|
||||
StreamingVersionData *version = new StreamingVersionData(
|
||||
@@ -475,7 +489,11 @@ void UpdateController::calculateCurrentSharedHash()
|
||||
{
|
||||
QList<FileData> *fileList = new QList<FileData>;
|
||||
QString fileName = Tools::createVersionHashFilepath(assetManager->getCurrentVersionData()->getViewName());
|
||||
fileList = calculateHash(currentStreamingPath);
|
||||
|
||||
hashCalculator->calculateHashes(currentStreamingPath);
|
||||
fileList = hashCalculator->getHashList();
|
||||
//fileList = calculateHash(currentStreamingPath);
|
||||
qDebug() << "Hash count: " << fileList->count();
|
||||
saveHash(fileName,fileList);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user