| 313 | } |
| 314 | |
| 315 | QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch) |
| 316 | { |
| 317 | QJsonObject root; |
| 318 | writeString(root, "name", patch->name); |
| 319 | |
| 320 | writeString(root, "uid", patch->uid); |
| 321 | |
| 322 | writeString(root, "version", patch->version); |
| 323 | |
| 324 | Meta::serializeFormatVersion(root, Meta::MetadataVersion::InitialRelease); |
| 325 | |
| 326 | MojangVersionFormat::writeVersionProperties(patch.get(), root); |
| 327 | |
| 328 | if(patch->mainJar) |
| 329 | { |
| 330 | root.insert("mainJar", libraryToJson(patch->mainJar.get())); |
| 331 | } |
| 332 | writeString(root, "appletClass", patch->appletClass); |
| 333 | writeStringList(root, "+tweakers", patch->addTweakers); |
| 334 | writeStringList(root, "+traits", patch->traits.values()); |
| 335 | if (!patch->libraries.isEmpty()) |
| 336 | { |
| 337 | QJsonArray array; |
| 338 | for (auto value: patch->libraries) |
| 339 | { |
| 340 | array.append(OneSixVersionFormat::libraryToJson(value.get())); |
| 341 | } |
| 342 | root.insert("libraries", array); |
| 343 | } |
| 344 | if (!patch->mavenFiles.isEmpty()) |
| 345 | { |
| 346 | QJsonArray array; |
| 347 | for (auto value: patch->mavenFiles) |
| 348 | { |
| 349 | array.append(OneSixVersionFormat::libraryToJson(value.get())); |
| 350 | } |
| 351 | root.insert("mavenFiles", array); |
| 352 | } |
| 353 | if (!patch->jarMods.isEmpty()) |
| 354 | { |
| 355 | QJsonArray array; |
| 356 | for (auto value: patch->jarMods) |
| 357 | { |
| 358 | array.append(OneSixVersionFormat::jarModtoJson(value.get())); |
| 359 | } |
| 360 | root.insert("jarMods", array); |
| 361 | } |
| 362 | if (!patch->mods.isEmpty()) |
| 363 | { |
| 364 | QJsonArray array; |
| 365 | for (auto value: patch->jarMods) |
| 366 | { |
| 367 | array.append(OneSixVersionFormat::modtoJson(value.get())); |
| 368 | } |
| 369 | root.insert("mods", array); |
| 370 | } |
| 371 | if(!patch->required.empty()) |
| 372 | { |
nothing calls this directly
no test coverage detected