NOISSUE silly/simple implementation of mod metadata in OneSix version format
This commit is contained in:
parent
581460dcf9
commit
f3c46dbf11
6 changed files with 72 additions and 4 deletions
|
@ -126,6 +126,18 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
|
|||
}
|
||||
}
|
||||
|
||||
if (root.contains("mods"))
|
||||
{
|
||||
for (auto libVal : requireArray(root.value("mods")))
|
||||
{
|
||||
QJsonObject libObj = requireObject(libVal);
|
||||
// parse the jarmod
|
||||
auto lib = OneSixVersionFormat::modFromJson(libObj, filename);
|
||||
// and add to jar mods
|
||||
out->mods.append(lib);
|
||||
}
|
||||
}
|
||||
|
||||
auto readLibs = [&](const char * which)
|
||||
{
|
||||
for (auto libVal : requireArray(root.value(which)))
|
||||
|
@ -246,6 +258,15 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
|
|||
}
|
||||
root.insert("jarMods", array);
|
||||
}
|
||||
if (!patch->mods.isEmpty())
|
||||
{
|
||||
QJsonArray array;
|
||||
for (auto value: patch->jarMods)
|
||||
{
|
||||
array.append(OneSixVersionFormat::modtoJson(value.get()));
|
||||
}
|
||||
root.insert("mods", array);
|
||||
}
|
||||
// write the contents to a json document.
|
||||
{
|
||||
QJsonDocument out;
|
||||
|
@ -306,3 +327,13 @@ QJsonObject OneSixVersionFormat::jarModtoJson(Library *jarmod)
|
|||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
LibraryPtr OneSixVersionFormat::modFromJson(const QJsonObject& libObj, const QString& filename)
|
||||
{
|
||||
return libraryFromJson(libObj, filename);
|
||||
}
|
||||
|
||||
QJsonObject OneSixVersionFormat::modtoJson(Library *jarmod)
|
||||
{
|
||||
return libraryToJson(jarmod);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue