| 254 | } |
| 255 | |
| 256 | QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch) |
| 257 | { |
| 258 | QJsonObject root; |
| 259 | writeString(root, "name", patch->name); |
| 260 | |
| 261 | writeString(root, "uid", patch->uid); |
| 262 | |
| 263 | writeString(root, "version", patch->version); |
| 264 | |
| 265 | Meta::serializeFormatVersion(root, Meta::MetadataVersion::InitialRelease); |
| 266 | |
| 267 | MojangVersionFormat::writeVersionProperties(patch.get(), root); |
| 268 | |
| 269 | if(patch->mainJar) |
| 270 | { |
| 271 | root.insert("mainJar", libraryToJson(patch->mainJar.get())); |
| 272 | } |
| 273 | writeString(root, "appletClass", patch->appletClass); |
| 274 | writeStringList(root, "+tweakers", patch->addTweakers); |
| 275 | writeStringList(root, "+traits", patch->traits.toList()); |
| 276 | if (!patch->libraries.isEmpty()) |
| 277 | { |
| 278 | QJsonArray array; |
| 279 | for (auto value: patch->libraries) |
| 280 | { |
| 281 | array.append(OneSixVersionFormat::libraryToJson(value.get())); |
| 282 | } |
| 283 | root.insert("libraries", array); |
| 284 | } |
| 285 | if (!patch->mavenFiles.isEmpty()) |
| 286 | { |
| 287 | QJsonArray array; |
| 288 | for (auto value: patch->mavenFiles) |
| 289 | { |
| 290 | array.append(OneSixVersionFormat::libraryToJson(value.get())); |
| 291 | } |
| 292 | root.insert("mavenFiles", array); |
| 293 | } |
| 294 | if (!patch->jarMods.isEmpty()) |
| 295 | { |
| 296 | QJsonArray array; |
| 297 | for (auto value: patch->jarMods) |
| 298 | { |
| 299 | array.append(OneSixVersionFormat::jarModtoJson(value.get())); |
| 300 | } |
| 301 | root.insert("jarMods", array); |
| 302 | } |
| 303 | if (!patch->mods.isEmpty()) |
| 304 | { |
| 305 | QJsonArray array; |
| 306 | for (auto value: patch->jarMods) |
| 307 | { |
| 308 | array.append(OneSixVersionFormat::modtoJson(value.get())); |
| 309 | } |
| 310 | root.insert("mods", array); |
| 311 | } |
| 312 | if(!patch->requires.empty()) |
| 313 | { |
nothing calls this directly
no test coverage detected