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