NOISSUE Rough refactor of ProfilePatch and VersionFile internals.

They are now distinct classes with distinct responsibilities.

* ProfilePatch is an entry in MinecraftProfile and can hold VersionFile or Meta::Version.
* VersionFile is the basic element that holds version information loaded from JSON.
* Meta::Version is the loader class for VersionFile(s) from a server.
This commit is contained in:
Petr Mrázek
2017-03-27 03:34:39 +02:00
parent 6f2a87167a
commit 5fabb4f254
22 changed files with 431 additions and 374 deletions

View File

@ -151,7 +151,7 @@ void MojangVersionFormat::readVersionProperties(const QJsonObject &in, VersionFi
}
else if (!toCompare.isEmpty())
{
out->addProblem(PROBLEM_ERROR, QObject::tr("processArguments is set to unknown value '%1'").arg(processArguments));
out->addProblem(ProblemSeverity::Error, QObject::tr("processArguments is set to unknown value '%1'").arg(processArguments));
}
}
Bits::readString(in, "type", out->type);
@ -166,8 +166,8 @@ void MojangVersionFormat::readVersionProperties(const QJsonObject &in, VersionFi
out->mojangAssetIndex = std::make_shared<MojangAssetIndexInfo>(out->assets);
}
out->m_releaseTime = timeFromS3Time(in.value("releaseTime").toString(""));
out->m_updateTime = timeFromS3Time(in.value("time").toString(""));
out->releaseTime = timeFromS3Time(in.value("releaseTime").toString(""));
out->updateTime = timeFromS3Time(in.value("time").toString(""));
if (in.contains("minimumLauncherVersion"))
{
@ -175,7 +175,7 @@ void MojangVersionFormat::readVersionProperties(const QJsonObject &in, VersionFi
if (out->minimumLauncherVersion > CURRENT_MINIMUM_LAUNCHER_VERSION)
{
out->addProblem(
PROBLEM_WARNING,
ProblemSeverity::Warning,
QObject::tr("The 'minimumLauncherVersion' value of this version (%1) is higher than supported by MultiMC (%2). It might not work properly!")
.arg(out->minimumLauncherVersion)
.arg(CURRENT_MINIMUM_LAUNCHER_VERSION));
@ -212,7 +212,7 @@ VersionFilePtr MojangVersionFormat::versionFileFromJson(const QJsonDocument &doc
out->name = "Minecraft";
out->uid = "net.minecraft";
out->version = out->minecraftVersion;
out->filename = filename;
// out->filename = filename;
if (root.contains("libraries"))
@ -234,13 +234,13 @@ void MojangVersionFormat::writeVersionProperties(const VersionFile* in, QJsonObj
writeString(out, "mainClass", in->mainClass);
writeString(out, "minecraftArguments", in->minecraftArguments);
writeString(out, "type", in->type);
if(!in->m_releaseTime.isNull())
if(!in->releaseTime.isNull())
{
writeString(out, "releaseTime", timeToS3Time(in->m_releaseTime));
writeString(out, "releaseTime", timeToS3Time(in->releaseTime));
}
if(!in->m_updateTime.isNull())
if(!in->updateTime.isNull())
{
writeString(out, "time", timeToS3Time(in->m_updateTime));
writeString(out, "time", timeToS3Time(in->updateTime));
}
if(in->minimumLauncherVersion != -1)
{