diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-07 01:38:18 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-07 01:38:18 +0200 |
commit | afaa1dc223ec87b685778ee0aed81cb6caaa05c7 (patch) | |
tree | 4e1e6589d56ba9bc6984547d158d413a0495272f /backend/VersionFactory.cpp | |
parent | 091b7502cfc1bc01a1abd68a0fb9a0b2693a4658 (diff) | |
download | MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.gz MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.lz MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.tar.xz MultiMC-afaa1dc223ec87b685778ee0aed81cb6caaa05c7.zip |
Get rid of QNAM (now subclassed and less needy). Basic LWJGL download and extraction.
Diffstat (limited to 'backend/VersionFactory.cpp')
-rw-r--r-- | backend/VersionFactory.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/backend/VersionFactory.cpp b/backend/VersionFactory.cpp index 7bec4370..a431ca26 100644 --- a/backend/VersionFactory.cpp +++ b/backend/VersionFactory.cpp @@ -80,6 +80,16 @@ QSharedPointer<FullVersion> FullVersionFactory::parse4(QJsonObject root, QShared fullVersion->minecraftArguments = minecraftArgsValue.toString(); } + auto minecraftTypeValue = root.value("type"); + if(minecraftTypeValue.isString()) + { + QString copy = fullVersion->type = minecraftTypeValue.toString(); + if(copy == "old_aplha" || copy == "old_beta") + { + fullVersion->isLegacy = true; + } + } + fullVersion->releaseTime = root.value("releaseTime").toString(); fullVersion->time = root.value("time").toString(); @@ -107,7 +117,7 @@ QSharedPointer<FullVersion> FullVersionFactory::parse4(QJsonObject root, QShared auto urlVal = libObj.value("url"); if(urlVal.isString()) { - library->setBaseUrl(urlVal.toString()); + library->setBaseUrl(nameVal.toString()); } // Extract excludes (if any) @@ -175,19 +185,15 @@ QSharedPointer<FullVersion> FullVersionFactory::parse(QByteArray data) } QJsonObject root = jsonDoc.object(); - readVersion->minimumLauncherVersion = root.value("minimumLauncherVersion").toDouble(); - switch(readVersion->minimumLauncherVersion) + int launcher_ver = readVersion->minimumLauncherVersion = root.value("minimumLauncherVersion").toDouble(); + // ADD MORE HERE :D + if(launcher_ver > 0 && launcher_ver <= 7) + return parse4(root, readVersion); + else { - case 1: - case 2: - case 3: - case 4: - return parse4(root, readVersion); - // ADD MORE HERE :D - default: - error_string = "Version file was for an unrecognized launcher version. RIP"; - m_error = FullVersionFactory::UnsupportedVersion; - return QSharedPointer<FullVersion>(); + error_string = "Version file was for an unrecognized launcher version. RIP"; + m_error = FullVersionFactory::UnsupportedVersion; + return QSharedPointer<FullVersion>(); } } |