| 283 | } |
| 284 | |
| 285 | QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr& patch) |
| 286 | { |
| 287 | QJsonObject root; |
| 288 | writeString(root, "name", patch->name); |
| 289 | |
| 290 | writeString(root, "uid", patch->uid); |
| 291 | |
| 292 | writeString(root, "version", patch->version); |
| 293 | |
| 294 | Meta::serializeFormatVersion(root, Meta::MetadataVersion::InitialRelease); |
| 295 | |
| 296 | MojangVersionFormat::writeVersionProperties(patch.get(), root); |
| 297 | |
| 298 | if (patch->mainJar) { |
| 299 | root.insert("mainJar", libraryToJson(patch->mainJar.get())); |
| 300 | } |
| 301 | writeString(root, "appletClass", patch->appletClass); |
| 302 | writeStringList(root, "+tweakers", patch->addTweakers); |
| 303 | writeStringList(root, "+traits", patch->traits.values()); |
| 304 | writeStringList(root, "+jvmArgs", patch->addnJvmArguments); |
| 305 | if (!patch->agents.isEmpty()) { |
| 306 | QJsonArray array; |
| 307 | for (const auto& value : patch->agents) { |
| 308 | QJsonObject agentOut = OneSixVersionFormat::libraryToJson(value.library.get()); |
| 309 | if (!value.argument.isEmpty()) |
| 310 | agentOut.insert("argument", value.argument); |
| 311 | |
| 312 | array.append(agentOut); |
| 313 | } |
| 314 | root.insert("+agents", array); |
| 315 | } |
| 316 | if (!patch->libraries.isEmpty()) { |
| 317 | QJsonArray array; |
| 318 | for (auto value : patch->libraries) { |
| 319 | array.append(OneSixVersionFormat::libraryToJson(value.get())); |
| 320 | } |
| 321 | root.insert("libraries", array); |
| 322 | } |
| 323 | if (!patch->mavenFiles.isEmpty()) { |
| 324 | QJsonArray array; |
| 325 | for (auto value : patch->mavenFiles) { |
| 326 | array.append(OneSixVersionFormat::libraryToJson(value.get())); |
| 327 | } |
| 328 | root.insert("mavenFiles", array); |
| 329 | } |
| 330 | if (!patch->jarMods.isEmpty()) { |
| 331 | QJsonArray array; |
| 332 | for (auto value : patch->jarMods) { |
| 333 | array.append(OneSixVersionFormat::jarModtoJson(value.get())); |
| 334 | } |
| 335 | root.insert("jarMods", array); |
| 336 | } |
| 337 | if (!patch->mods.isEmpty()) { |
| 338 | QJsonArray array; |
| 339 | for (auto value : patch->jarMods) { |
| 340 | array.append(OneSixVersionFormat::modtoJson(value.get())); |
| 341 | } |
| 342 | root.insert("mods", array); |
nothing calls this directly
no test coverage detected