mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: update controller add sort
This commit is contained in:
@@ -9,11 +9,17 @@ struct FileData
|
||||
QString path;
|
||||
QString hash;
|
||||
|
||||
bool operator==(const FileData& other)const{
|
||||
bool operator==(const FileData& other)const
|
||||
{
|
||||
if(this->path==(other.path)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator<(const FileData& data2) const
|
||||
{
|
||||
return this->hash == "FOLDER" && data2.hash !="FOLDER";
|
||||
}
|
||||
|
||||
}; //путь
|
||||
|
||||
struct SAttribute
|
||||
|
||||
@@ -12,8 +12,9 @@ UpdateController::UpdateController(DataParser *parser,SendSystem *sendSystem, QO
|
||||
void UpdateController::calculateCommonHash()
|
||||
{
|
||||
appDataList.clear();
|
||||
appDataList = calculateHash(applicationFolderPath);
|
||||
appDataList = calculateHash(applicationFolderPath,"StreamingAssets");
|
||||
calculateStreamingHash();
|
||||
appDataList.append(streamingDataList);
|
||||
dataParser->createFileDataList(appDataList,hashFilename);
|
||||
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
|
||||
}
|
||||
@@ -21,8 +22,9 @@ void UpdateController::calculateCommonHash()
|
||||
void UpdateController::calculateStreamingHash()
|
||||
{
|
||||
streamingDataList.clear();
|
||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath);
|
||||
dataParser->createFileDataList(appDataList,streamingHashFilename);
|
||||
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
||||
std::sort(streamingDataList.begin(),streamingDataList.end());
|
||||
dataParser->createFileDataList(streamingDataList,streamingHashFilename);
|
||||
}
|
||||
|
||||
void UpdateController::setServerVersion(StreamingVersionData *version)
|
||||
@@ -30,7 +32,7 @@ void UpdateController::setServerVersion(StreamingVersionData *version)
|
||||
serverVersion = version;
|
||||
}
|
||||
|
||||
QList<FileData> UpdateController::calculateHash(QString path)
|
||||
QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
|
||||
{
|
||||
qDebug() << "Try calculate";
|
||||
|
||||
@@ -56,6 +58,7 @@ QList<FileData> UpdateController::calculateHash(QString path)
|
||||
const quint64 bufferSize = 10240;
|
||||
|
||||
if(fileInfo.isHidden()) continue;
|
||||
if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
|
||||
|
||||
if(fileInfo.isFile() && file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
@@ -90,6 +93,8 @@ QList<FileData> UpdateController::calculateHash(QString path)
|
||||
|
||||
}
|
||||
|
||||
std::sort(hashes->begin(),hashes->end());
|
||||
|
||||
return *hashes;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
QList<FileData> streamingDataList;
|
||||
StreamingVersionData *serverVersion;
|
||||
|
||||
QList<FileData> calculateHash(QString path);
|
||||
QList<FileData> calculateHash(QString path,QString ignoreName);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user