From 02c1df2c3c260fe625b9c3314e9eed2885a97456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 13 Mar 2016 00:23:45 +0100 Subject: NOISSUE continue version file format refactors --- logic/minecraft/MinecraftVersion.cpp | 67 +++++++++++------------------------- 1 file changed, 20 insertions(+), 47 deletions(-) (limited to 'logic/minecraft/MinecraftVersion.cpp') diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp index 8a1ac501..3224de4c 100644 --- a/logic/minecraft/MinecraftVersion.cpp +++ b/logic/minecraft/MinecraftVersion.cpp @@ -43,6 +43,11 @@ QString MinecraftVersion::typeString() const } } +VersionSource MinecraftVersion::getVersionSource() +{ + return m_versionSource; +} + bool MinecraftVersion::hasJarMods() { return false; @@ -64,19 +69,6 @@ void MinecraftVersion::applyFileTo(MinecraftProfile *version) throw VersionIncomplete(QObject::tr("Can't apply incomplete/builtin Minecraft version %1").arg(m_name)); } } -/* -QJsonDocument MinecraftVersion::toJson(bool saveOrder) -{ - if(m_versionSource == Local && getVersionFile()) - { - return getVersionFile()->toJson(saveOrder); - } - else - { - throw VersionIncomplete(QObject::tr("Can't write incomplete/builtin Minecraft version %1").arg(m_name)); - } -} -*/ QString MinecraftVersion::getUrl() const { @@ -171,36 +163,12 @@ void MinecraftVersion::applyTo(MinecraftProfile *version) throw VersionIncomplete(QObject::tr( "Minecraft version %1 could not be applied: version files are missing.").arg(m_descriptor)); } - if (!m_descriptor.isNull()) - { - version->id = m_descriptor; - } - if (!m_mainClass.isNull()) - { - version->mainClass = m_mainClass; - } - if (!m_appletClass.isNull()) - { - version->appletClass = m_appletClass; - } - if (!m_processArguments.isNull()) - { - version->vanillaProcessArguments = m_processArguments; - version->processArguments = m_processArguments; - } - if (!m_type.isNull()) - { - version->type = m_type; - } - if (!m_releaseTime.isNull()) - { - version->m_releaseTime = m_releaseTime; - } - if (!m_updateTime.isNull()) - { - version->m_updateTime = m_updateTime; - } - version->traits.unite(m_traits); + version->applyMinecraftVersion(m_descriptor); + version->applyMainClass(m_mainClass); + version->applyAppletClass(m_appletClass); + version->applyMinecraftArguments(" ${auth_player_name} ${auth_session}", true); // all builtin versions are legacy + version->applyMinecraftVersionType(m_type); + version->applyTraits(m_traits); } int MinecraftVersion::getOrder() @@ -218,22 +186,27 @@ QList MinecraftVersion::getJarMods() return QList(); } -QString MinecraftVersion::getPatchName() +QString MinecraftVersion::getName() { return "Minecraft"; } -QString MinecraftVersion::getPatchVersion() +QString MinecraftVersion::getVersion() { return m_descriptor; } -QString MinecraftVersion::getPatchID() +QString MinecraftVersion::getID() { return "net.minecraft"; } -QString MinecraftVersion::getPatchFilename() +QString MinecraftVersion::getFilename() { return QString(); } +QDateTime MinecraftVersion::getReleaseDateTime() +{ + return m_releaseTime; +} + bool MinecraftVersion::needsUpdate() { -- cgit v1.2.3