mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: fast hash checker
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "UpdateController.h"
|
||||
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QThread>
|
||||
|
||||
UpdateController::UpdateController(QObject *parent) :
|
||||
@@ -15,23 +16,33 @@ void UpdateController::initialize(VersionContainer *versionContainer,DataParserO
|
||||
this->versionContainer = versionContainer;
|
||||
this->sendSystem = sendSystem;
|
||||
this->dataParserOut = dataParserOut;
|
||||
hashCalculator = new FastHashCalculator;
|
||||
}
|
||||
|
||||
void UpdateController::calculateCommonHash()
|
||||
{
|
||||
appDataList.clear();
|
||||
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
qDebug() << "Start calculate... ";
|
||||
//appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
||||
hashCalculator->calculateHashes(applicationFolderPath,"StreamingAssets");
|
||||
appDataList = *hashCalculator->getHashList();
|
||||
calculateStreamingHash();
|
||||
appDataList.append(streamingDataList);
|
||||
qDebug() << "Hash count: " << appDataList.count() ;
|
||||
dataParserOut->createFileDataList(appDataList,fullStaticDataFolderName + hashFilename);
|
||||
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
||||
qDebug() <<"Calculate time " << timer.elapsed();
|
||||
}
|
||||
|
||||
void UpdateController::calculateStreamingHash()
|
||||
{
|
||||
streamingDataList.clear();
|
||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
||||
std::sort(streamingDataList.begin(),streamingDataList.end());
|
||||
//streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
||||
hashCalculator->calculateHashes(QDir::currentPath() + streamingAssetsPath,"");
|
||||
streamingDataList = *hashCalculator->getHashList();
|
||||
//std::sort(streamingDataList.begin(),streamingDataList.end());
|
||||
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||
}
|
||||
|
||||
@@ -84,7 +95,7 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
||||
|
||||
emit sigSendHashInfo(fullSize,Tools::convertFileSize(currentSize,false));
|
||||
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
|
||||
const quint64 bufferSize = 10240;
|
||||
const quint64 bufferSize = 1024;
|
||||
|
||||
if(fileInfo.isHidden()) continue;
|
||||
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
||||
|
||||
Reference in New Issue
Block a user