| 283 | } |
| 284 | |
| 285 | std::shared_ptr<ModDetails> ReadLiteModInfo(QByteArray contents) |
| 286 | { |
| 287 | std::shared_ptr<ModDetails> details = std::make_shared<ModDetails>(); |
| 288 | QJsonParseError jsonError; |
| 289 | QJsonDocument jsonDoc = QJsonDocument::fromJson(contents, &jsonError); |
| 290 | auto object = jsonDoc.object(); |
| 291 | if (object.contains("name")) |
| 292 | { |
| 293 | details->mod_id = details->name = object.value("name").toString(); |
| 294 | } |
| 295 | if (object.contains("version")) |
| 296 | { |
| 297 | details->version = object.value("version").toString(""); |
| 298 | } |
| 299 | else |
| 300 | { |
| 301 | details->version = object.value("revision").toString(""); |
| 302 | } |
| 303 | details->mcversion = object.value("mcversion").toString(); |
| 304 | auto author = object.value("author").toString(); |
| 305 | if(!author.isEmpty()) { |
| 306 | details->authors.append(author); |
| 307 | } |
| 308 | details->description = object.value("description").toString(); |
| 309 | details->homeurl = object.value("url").toString(); |
| 310 | return details; |
| 311 | } |
| 312 | |
| 313 | } |
| 314 | |