NOISSUE silly/simple implementation of mod metadata in OneSix version format
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -22,4 +22,8 @@ public:
|
||||
// new jar mods derived from libraries
|
||||
static LibraryPtr jarModFromJson(const QJsonObject &libObj, const QString &filename);
|
||||
static QJsonObject jarModtoJson(Library * jarmod);
|
||||
|
||||
// mods, also derived from libraries
|
||||
static LibraryPtr modFromJson(const QJsonObject &libObj, const QString &filename);
|
||||
static QJsonObject modtoJson(Library * jarmod);
|
||||
};
|
||||
|
Reference in New Issue
Block a user