ref: change send command

This commit is contained in:
semenov
2025-01-17 10:49:27 +03:00
parent e1c3fcae36
commit 7b8f920cdc
47 changed files with 7765 additions and 600 deletions

View File

@@ -104,67 +104,6 @@ QList<FileData> UpdateController::calculateHash(QString path,QString ignoreName)
}
}
// QDirIterator iterator(dir,QDirIterator::Subdirectories);
//
// if(!QDir(path).exists())
// { //проверка на наличие папки
// QDir().mkdir(path);
// }
// QString hashString;
// while (iterator.hasNext())
// {
// iterator.next();
// QFileInfo fileInfo = iterator.fileInfo();
// FileData currentFile;
// QFile file(fileInfo.absoluteFilePath());
// quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
// const quint64 bufferSize = 10240;
// if(fileInfo.isHidden()) continue;
// if(ignoreName != "" && fileInfo.path().contains(ignoreName)) continue;
// if(fileInfo.isFile() && file.open(QIODevice::ReadOnly))
// {
// char buffer[bufferSize];
// int bytesRead;
// int readSize = qMin(fileSize,bufferSize);
// QCryptographicHash hash(QCryptographicHash::Md5);
// while(readSize > 0 && (bytesRead = file.read(buffer,readSize)) > 0){
// fileSize -= bytesRead;
// hash.addData(buffer,bytesRead);
// readSize = qMin(fileSize,bufferSize);
// }
// hashString = QString(hash.result().toHex());
// currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
// currentFile.hash = hashString;
// hashes->push_back(currentFile);
// file.close();
// }
// else if (fileInfo.isDir() && !fileInfo.isRoot() && fileInfo.fileName() != "..")
// {
// currentFile.path = Tools::createLocalPath(fileInfo.path());
// currentFile.hash = "FOLDER";
// if(!hashes->contains(currentFile))
// {
// hashes->push_back(currentFile);
// }
// }
// }
//std::sort(hashes->begin(),hashes->end());
return *hashes;
}
@@ -183,7 +122,8 @@ void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
}
else
{
sendSystem->sendFileBlock(data.path);
QString fullPath = Tools::createReceiveFullPath(data.path,versionContainer->getLocalVersionData());
sendSystem->sendFileBlockWithVersion(fullPath,data.path);
}
}