mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add send scenario
This commit is contained in:
@@ -25,11 +25,12 @@ void UpdateController::calculateCommonHash()
|
||||
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();
|
||||
@@ -39,10 +40,8 @@ void UpdateController::calculateCommonHash()
|
||||
void UpdateController::calculateStreamingHash()
|
||||
{
|
||||
streamingDataList.clear();
|
||||
//streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath,"");
|
||||
hashCalculator->calculateHashes(QDir::currentPath() + streamingAssetsPath,"");
|
||||
streamingDataList = *hashCalculator->getHashList();
|
||||
//std::sort(streamingDataList.begin(),streamingDataList.end());
|
||||
dataParserOut->createFileDataList(streamingDataList,streamingHashFilename);
|
||||
}
|
||||
|
||||
@@ -147,8 +146,8 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
||||
}
|
||||
|
||||
calculateCommonHash();
|
||||
sendSystem->sendFinish();
|
||||
|
||||
sendSystem->sendPacketType(PacketType::TYPE_FINISH);
|
||||
sendSystem->sendPacketType(PacketType::RECALCULATE_DOCS);
|
||||
emit sigUpdateComplete(true);
|
||||
}
|
||||
catch (...)
|
||||
|
||||
@@ -20,6 +20,7 @@ void FastHashCalculator::calculateHashes(const QString& path, const QString& ign
|
||||
QList<FileData> *folders = new QList<FileData>;
|
||||
fullSize = Tools::convertFileSize(getDirectorySize(path),false);
|
||||
|
||||
//только папки
|
||||
QDirIterator dirIterator(path,filter, QDir::AllEntries, QDirIterator::Subdirectories);
|
||||
|
||||
while (dirIterator.hasNext())
|
||||
@@ -38,7 +39,7 @@ void FastHashCalculator::calculateHashes(const QString& path, const QString& ign
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//только файлы
|
||||
QDirIterator fileIterator(path,filter,QDir::Files | QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
|
||||
|
||||
QList<QString> files;
|
||||
@@ -67,6 +68,7 @@ void FastHashCalculator::calculateHashes(const QString& path, const QString& ign
|
||||
|
||||
currentFile.path = Tools::createLocalPath(filePath);
|
||||
currentFile.hash = hash.toHex();
|
||||
|
||||
hashList->append(currentFile);
|
||||
}).waitForFinished();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
||||
{
|
||||
if(!serverStreamingHash->contains(item))
|
||||
{
|
||||
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||
files->append(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,6 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
if(packetType == PacketType::HASH_READY)
|
||||
{
|
||||
emit sigCheckUpdate();
|
||||
//mainWindow->checkUpdate();
|
||||
}
|
||||
|
||||
if(packetType == PacketType::HASH_CALCULATE_START)
|
||||
@@ -270,6 +269,10 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
emit sigAnimationActivated(false);
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_XMLANSWER_DOCS_CHANGED)
|
||||
{
|
||||
emit sigSendPacketType(PacketType::GET_DOCS);
|
||||
}
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ signals:
|
||||
void sigAnimationActivated(bool flag);
|
||||
void sigCheckUpdate();
|
||||
void sigdRecalculateHashOnServerState();
|
||||
void sigSendPacketType(PacketType packetType);
|
||||
|
||||
private:
|
||||
VersionContainer *versionContainer;
|
||||
|
||||
@@ -157,16 +157,6 @@ void SendSystem::sendXMLAnswer(const QByteArray& array)
|
||||
qDebug() << "Send XML answer in byte";
|
||||
}
|
||||
|
||||
void SendSystem::sendFinish()
|
||||
{
|
||||
socket->waitForReadyRead(100);
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
stream << PacketType::TYPE_FINISH;
|
||||
socket->waitForReadyRead(100);
|
||||
}
|
||||
|
||||
void SendSystem::sendPacketType(PacketType packetType)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
|
||||
@@ -12,12 +12,12 @@ QString Tools::getTime()
|
||||
|
||||
QString Tools::createLocalPath(QString path)
|
||||
{
|
||||
qDebug() << "Full path: " << path;
|
||||
//qDebug() << "Full path: " << path;
|
||||
qint8 pos = path.indexOf("Application");
|
||||
|
||||
QString localPath = path.remove(0,--pos);
|
||||
|
||||
qDebug() << "Local path: " << localPath;
|
||||
//qDebug() << "Local path: " << localPath;
|
||||
return localPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,13 +47,17 @@ enum PacketType{
|
||||
TYPE_UPDATE = 12,
|
||||
TYPE_CHECK_VERSION = 13,
|
||||
|
||||
TYPE_XMLANSWER_DOCS_CHANGED = 132,
|
||||
|
||||
HASH_READY = 150,
|
||||
CHANGE_DATA_VERSION = 151,
|
||||
COPY_VERSION = 152,
|
||||
DELETE_DATA_VERSION = 153,
|
||||
BUSY = 154,
|
||||
FREE = 155,
|
||||
HASH_CALCULATE_START = 156
|
||||
HASH_CALCULATE_START = 156,
|
||||
RECALCULATE_DOCS = 157,
|
||||
GET_DOCS = 158
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user