mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-21 19:27:15 +00:00
NOISSUE remove old unused version file features
This commit is contained in:
@@ -69,82 +69,6 @@ RawLibraryPtr RawLibrary::fromJson(const QJsonObject &libObj, const QString &fil
|
||||
return out;
|
||||
}
|
||||
|
||||
RawLibraryPtr RawLibrary::fromJsonPlus(const QJsonObject &libObj, const QString &filename)
|
||||
{
|
||||
auto lib = RawLibrary::fromJson(libObj, filename);
|
||||
if (libObj.contains("insert"))
|
||||
{
|
||||
QJsonValue insertVal = ensureJsonValue(libObj.value("insert"), QString("library insert rule"));
|
||||
if (insertVal.isString())
|
||||
{
|
||||
// it's just a simple string rule. OK.
|
||||
QString insertString = insertVal.toString();
|
||||
if (insertString == "apply")
|
||||
{
|
||||
lib->insertType = RawLibrary::Apply;
|
||||
}
|
||||
else if (insertString == "prepend")
|
||||
{
|
||||
lib->insertType = RawLibrary::Prepend;
|
||||
}
|
||||
else if (insertString == "append")
|
||||
{
|
||||
lib->insertType = RawLibrary::Append;
|
||||
}
|
||||
else if (insertString == "replace")
|
||||
{
|
||||
lib->insertType = RawLibrary::Replace;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw JSONValidationError("A '+' library in " + filename +
|
||||
" contains an invalid insert type");
|
||||
}
|
||||
}
|
||||
else if (insertVal.isObject())
|
||||
{
|
||||
// it's a more complex rule, specifying what should be:
|
||||
// * replaced (for now only this)
|
||||
// this was never used, AFAIK. tread carefully.
|
||||
QJsonObject insertObj = insertVal.toObject();
|
||||
if (insertObj.isEmpty())
|
||||
{
|
||||
throw JSONValidationError("Empty compound insert rule in " + filename);
|
||||
}
|
||||
QString insertString = insertObj.keys().first();
|
||||
// really, only replace makes sense in combination with
|
||||
if(insertString != "replace")
|
||||
{
|
||||
throw JSONValidationError("Compound insert rule is not 'replace' in " + filename);
|
||||
}
|
||||
lib->insertData = insertObj.value(insertString).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw JSONValidationError("A '+' library in " + filename +
|
||||
" contains an unknown/invalid insert rule");
|
||||
}
|
||||
}
|
||||
if (libObj.contains("MMC-depend"))
|
||||
{
|
||||
const QString dependString = requireString(libObj.value("MMC-depend"));
|
||||
if (dependString == "hard")
|
||||
{
|
||||
lib->dependType = RawLibrary::Hard;
|
||||
}
|
||||
else if (dependString == "soft")
|
||||
{
|
||||
lib->dependType = RawLibrary::Soft;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw JSONValidationError("A '+' library in " + filename +
|
||||
" contains an invalid depend type");
|
||||
}
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
QJsonObject RawLibrary::toJson() const
|
||||
{
|
||||
QJsonObject libRoot;
|
||||
|
||||
Reference in New Issue
Block a user