| 129 | } |
| 130 | |
| 131 | QList<downloadFile> updateFileHandler::getFilesToUpdate(updateFileHandler &localFiles) const |
| 132 | { |
| 133 | QList<downloadFile> updateList; |
| 134 | for (auto remoteFile : this->updateFileList) |
| 135 | { |
| 136 | bool fileFound = false; |
| 137 | bool updateNeeded = false; |
| 138 | for(auto localFile : localFiles.updateFileList) |
| 139 | { |
| 140 | if (localFile.filePath.toLower() == remoteFile.filePath.toLower()) |
| 141 | { |
| 142 | // File found. Do we need to update it? |
| 143 | updateNeeded = (localFile.version != remoteFile.version) || (localFile.hash != remoteFile.hash); |
| 144 | fileFound = true; |
| 145 | break; |
| 146 | } |
| 147 | } |
| 148 | if (!fileFound || updateNeeded) |
| 149 | updateList.append(downloadFile(remoteFile.filePath, remoteFile.fileSize)); |
| 150 | } |
| 151 | // No matter what, we will update the "versioninfo.txt" file (assume it to be 10kbyte) |
| 152 | updateList.append(downloadFile(UPDATEFILEHANDLER_FILE_NAME, 10000)); |
| 153 | return updateList; |
| 154 | } |
| 155 | |
| 156 | QString updateFileHandler::getInfo() const |
| 157 | { |