mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
bugfix: fast change version
This commit is contained in:
@@ -65,7 +65,8 @@ void UpdateController::deleteAssetVersion(QString versionName)
|
||||
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
|
||||
{
|
||||
mutex->lock();
|
||||
loadHash();
|
||||
serverDataList.clear();
|
||||
serverDataList = *loadHash(hashFileName);
|
||||
clientDataList.clear();
|
||||
xmlFileDataParse(array);
|
||||
checkNeedUpdate(handler);
|
||||
@@ -95,7 +96,7 @@ void UpdateController::calculateFullHash()
|
||||
void UpdateController::calculateFullHashWithSetup()
|
||||
{
|
||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_CALCULATE_START);
|
||||
calculateFullHash();
|
||||
calculateCurrentSharedHash();
|
||||
setUpCurrentServerHash();
|
||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
|
||||
}
|
||||
@@ -129,11 +130,11 @@ void UpdateController::saveHash(QString fileName,QList<FileData> *fileList)
|
||||
|
||||
}
|
||||
|
||||
void UpdateController::loadHash()
|
||||
QList<FileData>* UpdateController::loadHash(QString filename)
|
||||
{
|
||||
serverDataList.clear();
|
||||
QList<FileData> *files = new QList<FileData>();
|
||||
|
||||
QFile hashFile(hashFileName);
|
||||
QFile hashFile(filename);
|
||||
QByteArray array;
|
||||
if(hashFile.open(QIODevice::ReadOnly)){
|
||||
array = hashFile.readAll();
|
||||
@@ -161,7 +162,7 @@ void UpdateController::loadHash()
|
||||
data.hash = value;
|
||||
}
|
||||
|
||||
serverDataList.append(data);
|
||||
files->append(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -171,6 +172,8 @@ void UpdateController::loadHash()
|
||||
|
||||
emit sigLogMessage("Hash load from file ");
|
||||
|
||||
return files;
|
||||
|
||||
}
|
||||
|
||||
void UpdateController::calculateSize()
|
||||
@@ -203,12 +206,13 @@ QString UpdateController::getCommands()
|
||||
void UpdateController::setUpCurrentServerHash()
|
||||
{
|
||||
QList<FileData> *fileList = new QList<FileData>;
|
||||
fileList->append(*calculateHash(buildPath));
|
||||
fileList->append(*loadHash(buildHashName));
|
||||
FileData *streamingFolder = new FileData;
|
||||
streamingFolder->hash = "FOLDER";
|
||||
streamingFolder->path = buildDataPath + streamingAssetsFolderName;
|
||||
fileList->append(*streamingFolder);
|
||||
fileList->append(*calculateHash(currentStreamingPath));
|
||||
QString streamingHashFileName = Tools::createVersionHashFilepath(assetManager->getCurrentVersionData()->getViewName());
|
||||
fileList->append(*loadHash(streamingHashFileName));
|
||||
assetManager->prepareLocalPathList(fileList);
|
||||
|
||||
saveHash(hashFileName,fileList);
|
||||
@@ -462,23 +466,19 @@ void UpdateController::calculateSharedHash()
|
||||
StreamingVersionData *version = new StreamingVersionData(
|
||||
fileInfo.absoluteFilePath(),fileInfo.fileName(),
|
||||
fileInfo.birthTime(),fileInfo.size());
|
||||
|
||||
// if(fileInfo.fileName() == baseNameVersion)
|
||||
// {
|
||||
// version->setIsChangeable(false);
|
||||
// version->setAuthor(tr("Константа-дизайн"));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// version->setIsChangeable(true);
|
||||
// }
|
||||
|
||||
versionList->append(version);
|
||||
|
||||
}
|
||||
|
||||
assetManager->createFirstVersionListXML(*versionList);
|
||||
//assetManager->setVersionList(versionList);
|
||||
}
|
||||
|
||||
void UpdateController::calculateCurrentSharedHash()
|
||||
{
|
||||
QList<FileData> *fileList = new QList<FileData>;
|
||||
QString fileName = Tools::createVersionHashFilepath(assetManager->getCurrentVersionData()->getViewName());
|
||||
fileList = calculateHash(currentStreamingPath);
|
||||
saveHash(fileName,fileList);
|
||||
}
|
||||
|
||||
void UpdateController::sendNewVersionList()
|
||||
|
||||
@@ -96,9 +96,10 @@ private:
|
||||
void setLocalFileData(QList<FileData> dataList);
|
||||
void calculateSize();
|
||||
void saveHash(QString fileName,QList<FileData> *fileList);
|
||||
void loadHash();
|
||||
QList<FileData>* loadHash(QString fileName);
|
||||
void CalculateSizeToSend(QList<FileData> diffList);
|
||||
bool checkRequiredFolder();
|
||||
void calculateCurrentSharedHash();
|
||||
};
|
||||
|
||||
#endif // UPDATECONTROLLER_H
|
||||
|
||||
Reference in New Issue
Block a user