2015-02-03 03:55:30 +05:30
|
|
|
/* Copyright 2013-2015 MultiMC Contributors
|
2013-11-04 07:23:05 +05:30
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2013-09-22 07:51:36 +05:30
|
|
|
#include "ForgeInstaller.h"
|
2016-02-28 00:28:40 +05:30
|
|
|
#include "ForgeVersionList.h"
|
|
|
|
|
2015-02-09 06:21:14 +05:30
|
|
|
#include "minecraft/MinecraftProfile.h"
|
2016-02-26 06:34:21 +05:30
|
|
|
#include "minecraft/GradleSpecifier.h"
|
2015-02-09 06:21:14 +05:30
|
|
|
#include "net/HttpMetaCache.h"
|
|
|
|
#include "tasks/Task.h"
|
2016-02-28 00:28:40 +05:30
|
|
|
#include "minecraft/onesix/OneSixInstance.h"
|
2016-02-28 02:32:56 +05:30
|
|
|
#include <minecraft/onesix/OneSixVersionFormat.h>
|
2015-02-09 06:21:14 +05:30
|
|
|
#include "minecraft/VersionFilterData.h"
|
|
|
|
#include "Env.h"
|
2015-05-28 23:08:29 +05:30
|
|
|
#include "Exception.h"
|
2015-10-05 05:17:27 +05:30
|
|
|
#include <FileSystem.h>
|
2014-04-23 05:57:40 +05:30
|
|
|
|
2013-09-22 07:51:36 +05:30
|
|
|
#include <quazip.h>
|
|
|
|
#include <quazipfile.h>
|
|
|
|
#include <QStringList>
|
2014-01-27 23:50:07 +05:30
|
|
|
#include <QRegularExpression>
|
|
|
|
#include <QRegularExpressionMatch>
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2014-01-22 12:03:32 +05:30
|
|
|
#include <QJsonDocument>
|
2014-01-24 02:01:41 +05:30
|
|
|
#include <QJsonArray>
|
2014-01-22 12:03:32 +05:30
|
|
|
#include <QSaveFile>
|
|
|
|
#include <QCryptographicHash>
|
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
ForgeInstaller::ForgeInstaller() : BaseInstaller()
|
2014-03-15 01:18:57 +05:30
|
|
|
{
|
|
|
|
}
|
2014-12-28 03:15:49 +05:30
|
|
|
|
2014-03-15 01:18:57 +05:30
|
|
|
void ForgeInstaller::prepare(const QString &filename, const QString &universalUrl)
|
2013-09-22 07:51:36 +05:30
|
|
|
{
|
2015-01-28 03:01:07 +05:30
|
|
|
std::shared_ptr<MinecraftProfile> newVersion;
|
2014-03-15 01:18:57 +05:30
|
|
|
m_universal_url = universalUrl;
|
2013-09-22 07:51:36 +05:30
|
|
|
|
|
|
|
QuaZip zip(filename);
|
|
|
|
if (!zip.open(QuaZip::mdUnzip))
|
|
|
|
return;
|
|
|
|
|
|
|
|
QuaZipFile file(&zip);
|
|
|
|
|
|
|
|
// read the install profile
|
|
|
|
if (!zip.setCurrentFile("install_profile.json"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
QJsonParseError jsonError;
|
|
|
|
if (!file.open(QIODevice::ReadOnly))
|
|
|
|
return;
|
|
|
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll(), &jsonError);
|
|
|
|
file.close();
|
|
|
|
if (jsonError.error != QJsonParseError::NoError)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!jsonDoc.isObject())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QJsonObject root = jsonDoc.object();
|
|
|
|
|
|
|
|
auto installVal = root.value("install");
|
|
|
|
auto versionInfoVal = root.value("versionInfo");
|
|
|
|
if (!installVal.isObject() || !versionInfoVal.isObject())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// read the forge version info
|
|
|
|
{
|
2016-02-28 23:31:54 +05:30
|
|
|
newVersion = OneSixVersionFormat::profileFromSingleJson(versionInfoVal.toObject());
|
2013-09-22 07:51:36 +05:30
|
|
|
if (!newVersion)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QJsonObject installObj = installVal.toObject();
|
|
|
|
QString libraryName = installObj.value("path").toString();
|
|
|
|
internalPath = installObj.value("filePath").toString();
|
2014-02-01 19:22:21 +05:30
|
|
|
m_forgeVersionString = installObj.value("version").toString().remove("Forge").trimmed();
|
2013-09-22 07:51:36 +05:30
|
|
|
|
|
|
|
// where do we put the library? decode the mojang path
|
2016-02-26 06:34:21 +05:30
|
|
|
GradleSpecifier lib(libraryName);
|
2013-09-22 17:30:37 +05:30
|
|
|
|
2016-02-26 06:34:21 +05:30
|
|
|
auto cacheentry = ENV.metacache()->resolveEntry("libraries", lib.toPath());
|
|
|
|
finalPath = "libraries/" + lib.toPath();
|
2015-10-05 05:17:27 +05:30
|
|
|
if (!FS::ensureFilePathExists(finalPath))
|
2013-09-22 07:51:36 +05:30
|
|
|
return;
|
|
|
|
|
|
|
|
if (!zip.setCurrentFile(internalPath))
|
|
|
|
return;
|
|
|
|
if (!file.open(QIODevice::ReadOnly))
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
QByteArray data = file.readAll();
|
|
|
|
// extract file
|
|
|
|
QSaveFile extraction(finalPath);
|
|
|
|
if (!extraction.open(QIODevice::WriteOnly))
|
|
|
|
return;
|
|
|
|
if (extraction.write(data) != data.size())
|
|
|
|
return;
|
|
|
|
if (!extraction.commit())
|
|
|
|
return;
|
2013-09-22 17:30:37 +05:30
|
|
|
QCryptographicHash md5sum(QCryptographicHash::Md5);
|
|
|
|
md5sum.addData(data);
|
|
|
|
|
|
|
|
cacheentry->stale = false;
|
|
|
|
cacheentry->md5sum = md5sum.result().toHex().constData();
|
2015-01-31 21:29:03 +05:30
|
|
|
ENV.metacache()->updateEntry(cacheentry);
|
2013-09-22 07:51:36 +05:30
|
|
|
}
|
|
|
|
file.close();
|
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
m_forge_json = newVersion;
|
2016-03-13 04:53:45 +05:30
|
|
|
//m_forge_json->id = installObj.value("minecraft").toString();
|
2013-09-22 07:51:36 +05:30
|
|
|
}
|
2014-12-28 03:15:49 +05:30
|
|
|
|
2014-01-24 22:42:02 +05:30
|
|
|
bool ForgeInstaller::add(OneSixInstance *to)
|
2013-09-22 07:51:36 +05:30
|
|
|
{
|
2014-01-24 02:01:41 +05:30
|
|
|
if (!BaseInstaller::add(to))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QJsonObject obj;
|
|
|
|
obj.insert("order", 5);
|
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
if (!m_forge_json)
|
2013-09-22 07:51:36 +05:30
|
|
|
return false;
|
|
|
|
{
|
2016-03-13 04:53:45 +05:30
|
|
|
QJsonArray libraries;
|
2014-07-20 02:46:02 +05:30
|
|
|
// A blacklist
|
|
|
|
QSet<QString> blacklist{"authlib", "realms"};
|
2014-12-28 03:15:49 +05:30
|
|
|
//
|
2014-07-07 12:10:03 +05:30
|
|
|
QList<QString> xzlist{"org.scala-lang", "com.typesafe"};
|
|
|
|
// for each library in the version we are adding (except for the blacklisted)
|
2016-03-13 04:53:45 +05:30
|
|
|
for (auto lib : m_forge_json->getLibraries())
|
2013-09-22 07:51:36 +05:30
|
|
|
{
|
2014-07-27 02:30:35 +05:30
|
|
|
QString libName = lib->artifactId();
|
2014-07-07 12:10:03 +05:30
|
|
|
QString rawName = lib->rawName();
|
|
|
|
|
2014-07-20 02:46:02 +05:30
|
|
|
// ignore lwjgl libraries.
|
2014-07-27 02:30:35 +05:30
|
|
|
if (g_VersionFilterData.lwjglWhitelist.contains(lib->artifactPrefix()))
|
2014-07-20 02:46:02 +05:30
|
|
|
continue;
|
|
|
|
// ignore other blacklisted (realms, authlib)
|
2014-07-07 12:10:03 +05:30
|
|
|
if (blacklist.contains(libName))
|
|
|
|
continue;
|
|
|
|
|
2013-09-30 06:04:46 +05:30
|
|
|
// WARNING: This could actually break.
|
2013-09-22 07:51:36 +05:30
|
|
|
// if this is the actual forge lib, set an absolute url for the download
|
2014-12-28 03:15:49 +05:30
|
|
|
if (m_forge_version->type == ForgeVersion::Gradle)
|
2013-09-22 07:51:36 +05:30
|
|
|
{
|
2014-07-20 02:46:02 +05:30
|
|
|
if (libName == "forge")
|
|
|
|
{
|
2014-07-27 02:30:35 +05:30
|
|
|
lib->setClassifier("universal");
|
2014-07-20 02:46:02 +05:30
|
|
|
}
|
|
|
|
else if (libName == "minecraftforge")
|
|
|
|
{
|
2014-12-28 03:15:49 +05:30
|
|
|
QString forgeCoord("net.minecraftforge:forge:%1:universal");
|
2014-07-20 02:46:02 +05:30
|
|
|
// using insane form of the MC version...
|
2014-12-28 03:15:49 +05:30
|
|
|
QString longVersion =
|
|
|
|
m_forge_version->mcver + "-" + m_forge_version->jobbuildver;
|
2014-07-20 02:46:02 +05:30
|
|
|
GradleSpecifier spec(forgeCoord.arg(longVersion));
|
2014-07-27 02:30:35 +05:30
|
|
|
lib->setRawName(spec);
|
2014-07-20 02:46:02 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (libName.contains("minecraftforge"))
|
|
|
|
{
|
|
|
|
lib->setAbsoluteUrl(m_universal_url);
|
|
|
|
}
|
2013-09-22 07:51:36 +05:30
|
|
|
}
|
2014-07-07 12:10:03 +05:30
|
|
|
|
|
|
|
// WARNING: This could actually break.
|
|
|
|
// mark bad libraries based on the xzlist above
|
2014-12-28 03:15:49 +05:30
|
|
|
for (auto entry : xzlist)
|
2013-09-30 06:04:46 +05:30
|
|
|
{
|
2015-02-02 06:44:14 +05:30
|
|
|
qDebug() << "Testing " << rawName << " : " << entry;
|
2014-12-28 03:15:49 +05:30
|
|
|
if (rawName.startsWith(entry))
|
2014-07-07 12:10:03 +05:30
|
|
|
{
|
|
|
|
lib->setHint("forge-pack-xz");
|
|
|
|
break;
|
|
|
|
}
|
2013-09-30 06:04:46 +05:30
|
|
|
}
|
2013-09-22 07:51:36 +05:30
|
|
|
|
2016-02-28 23:31:54 +05:30
|
|
|
QJsonObject libObj = OneSixVersionFormat::libraryToJson(lib.get());
|
2014-01-24 02:01:41 +05:30
|
|
|
|
2014-01-27 23:50:07 +05:30
|
|
|
bool equals = false;
|
2014-01-24 02:01:41 +05:30
|
|
|
// find an entry that matches this one
|
2016-03-13 04:53:45 +05:30
|
|
|
for (auto tolib : to->getMinecraftProfile()->getVanillaLibraries())
|
2013-09-22 07:51:36 +05:30
|
|
|
{
|
2014-07-27 02:30:35 +05:30
|
|
|
if (tolib->artifactId() != libName)
|
2013-09-22 07:51:36 +05:30
|
|
|
continue;
|
2016-02-28 23:31:54 +05:30
|
|
|
if (OneSixVersionFormat::libraryToJson(tolib.get()) == libObj)
|
2014-01-27 23:50:07 +05:30
|
|
|
{
|
|
|
|
equals = true;
|
|
|
|
}
|
2013-09-22 07:51:36 +05:30
|
|
|
break;
|
|
|
|
}
|
2014-01-27 23:50:07 +05:30
|
|
|
if (equals)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2016-03-13 04:53:45 +05:30
|
|
|
libraries.append(libObj);
|
2013-09-22 07:51:36 +05:30
|
|
|
}
|
2016-03-13 04:53:45 +05:30
|
|
|
obj.insert("libraries", libraries);
|
|
|
|
obj.insert("mainClass", m_forge_json->getMainClass());
|
|
|
|
QString args = m_forge_json->getMinecraftArguments();
|
2014-01-27 23:50:07 +05:30
|
|
|
QStringList tweakers;
|
|
|
|
{
|
|
|
|
QRegularExpression expression("--tweakClass ([a-zA-Z0-9\\.]*)");
|
|
|
|
QRegularExpressionMatch match = expression.match(args);
|
|
|
|
while (match.hasMatch())
|
|
|
|
{
|
|
|
|
tweakers.append(match.captured(1));
|
|
|
|
args.remove(match.capturedStart(), match.capturedLength());
|
|
|
|
match = expression.match(args);
|
|
|
|
}
|
|
|
|
}
|
2016-03-13 04:53:45 +05:30
|
|
|
if (!args.isEmpty() && args != to->getMinecraftProfile()->getVanillaMinecraftArguments())
|
2014-01-27 23:50:07 +05:30
|
|
|
{
|
|
|
|
obj.insert("minecraftArguments", args);
|
|
|
|
}
|
|
|
|
if (!tweakers.isEmpty())
|
|
|
|
{
|
|
|
|
obj.insert("+tweakers", QJsonArray::fromStringList(tweakers));
|
|
|
|
}
|
2014-01-24 02:01:41 +05:30
|
|
|
}
|
|
|
|
|
2014-02-01 19:22:21 +05:30
|
|
|
obj.insert("name", QString("Forge"));
|
2014-02-01 20:56:38 +05:30
|
|
|
obj.insert("fileId", id());
|
2014-02-01 19:22:21 +05:30
|
|
|
obj.insert("version", m_forgeVersionString);
|
|
|
|
obj.insert("mcVersion", to->intendedVersionId());
|
|
|
|
|
2014-01-24 02:01:41 +05:30
|
|
|
QFile file(filename(to->instanceRoot()));
|
|
|
|
if (!file.open(QFile::WriteOnly))
|
|
|
|
{
|
2015-02-02 06:44:14 +05:30
|
|
|
qCritical() << "Error opening" << file.fileName()
|
2014-01-27 23:50:07 +05:30
|
|
|
<< "for reading:" << file.errorString();
|
2014-01-24 02:01:41 +05:30
|
|
|
return false;
|
2013-09-22 07:51:36 +05:30
|
|
|
}
|
2014-01-24 02:01:41 +05:30
|
|
|
file.write(QJsonDocument(obj).toJson());
|
|
|
|
file.close();
|
|
|
|
|
2014-01-22 12:03:32 +05:30
|
|
|
return true;
|
2013-09-22 07:51:36 +05:30
|
|
|
}
|
2014-03-15 01:18:57 +05:30
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
bool ForgeInstaller::addLegacy(OneSixInstance *to)
|
|
|
|
{
|
|
|
|
if (!BaseInstaller::add(to))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2015-01-31 21:29:03 +05:30
|
|
|
auto entry = ENV.metacache()->resolveEntry("minecraftforge", m_forge_version->filename());
|
2015-10-05 05:17:27 +05:30
|
|
|
finalPath = FS::PathCombine(to->jarModsDir(), m_forge_version->filename());
|
|
|
|
if (!FS::ensureFilePathExists(finalPath))
|
2014-05-05 03:40:59 +05:30
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-12-28 03:15:49 +05:30
|
|
|
if (!QFile::copy(entry->getFullPath(), finalPath))
|
2014-05-05 03:40:59 +05:30
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-23 05:57:40 +05:30
|
|
|
QJsonObject obj;
|
|
|
|
obj.insert("order", 5);
|
|
|
|
{
|
|
|
|
QJsonArray jarmodsPlus;
|
|
|
|
{
|
|
|
|
QJsonObject libObj;
|
|
|
|
libObj.insert("name", m_forge_version->universal_filename);
|
|
|
|
jarmodsPlus.append(libObj);
|
|
|
|
}
|
|
|
|
obj.insert("+jarMods", jarmodsPlus);
|
|
|
|
}
|
|
|
|
|
|
|
|
obj.insert("name", QString("Forge"));
|
|
|
|
obj.insert("fileId", id());
|
|
|
|
obj.insert("version", m_forge_version->jobbuildver);
|
|
|
|
obj.insert("mcVersion", to->intendedVersionId());
|
2014-05-05 03:40:59 +05:30
|
|
|
if (g_VersionFilterData.fmlLibsMapping.contains(m_forge_version->mcver))
|
2014-04-23 05:57:40 +05:30
|
|
|
{
|
|
|
|
QJsonArray traitsPlus;
|
|
|
|
traitsPlus.append(QString("legacyFML"));
|
|
|
|
obj.insert("+traits", traitsPlus);
|
|
|
|
}
|
2015-01-28 03:01:07 +05:30
|
|
|
auto fullversion = to->getMinecraftProfile();
|
2014-05-05 03:40:59 +05:30
|
|
|
fullversion->remove("net.minecraftforge");
|
2014-12-28 03:15:49 +05:30
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
QFile file(filename(to->instanceRoot()));
|
|
|
|
if (!file.open(QFile::WriteOnly))
|
|
|
|
{
|
2015-02-02 06:44:14 +05:30
|
|
|
qCritical() << "Error opening" << file.fileName()
|
2014-04-23 05:57:40 +05:30
|
|
|
<< "for reading:" << file.errorString();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
file.write(QJsonDocument(obj).toJson());
|
|
|
|
file.close();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-15 01:18:57 +05:30
|
|
|
class ForgeInstallTask : public Task
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-04-23 05:57:40 +05:30
|
|
|
ForgeInstallTask(ForgeInstaller *installer, OneSixInstance *instance,
|
|
|
|
BaseVersionPtr version, QObject *parent = 0)
|
2014-03-15 01:18:57 +05:30
|
|
|
: Task(parent), m_installer(installer), m_instance(instance), m_version(version)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void executeTask() override
|
|
|
|
{
|
2015-05-05 05:03:34 +05:30
|
|
|
setStatus(tr("Installing Forge..."));
|
2014-04-23 05:57:40 +05:30
|
|
|
ForgeVersionPtr forgeVersion = std::dynamic_pointer_cast<ForgeVersion>(m_version);
|
|
|
|
if (!forgeVersion)
|
2014-03-15 01:18:57 +05:30
|
|
|
{
|
2014-04-23 05:57:40 +05:30
|
|
|
emitFailed(tr("Unknown error occured"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
prepare(forgeVersion);
|
|
|
|
}
|
|
|
|
void prepare(ForgeVersionPtr forgeVersion)
|
|
|
|
{
|
2015-01-31 21:29:03 +05:30
|
|
|
auto entry = ENV.metacache()->resolveEntry("minecraftforge", forgeVersion->filename());
|
2014-04-23 05:57:40 +05:30
|
|
|
auto installFunction = [this, entry, forgeVersion]()
|
|
|
|
{
|
|
|
|
if (!install(entry, forgeVersion))
|
2014-03-15 01:18:57 +05:30
|
|
|
{
|
2015-05-05 05:03:34 +05:30
|
|
|
qCritical() << "Failure installing Forge";
|
|
|
|
emitFailed(tr("Failure to install Forge"));
|
2014-03-15 01:18:57 +05:30
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-23 05:57:40 +05:30
|
|
|
reload();
|
2014-03-15 01:18:57 +05:30
|
|
|
}
|
2014-04-23 05:57:40 +05:30
|
|
|
};
|
2014-05-05 03:40:59 +05:30
|
|
|
|
2014-12-28 03:15:49 +05:30
|
|
|
/*
|
|
|
|
* HACK IF the local non-stale file is too small, mark is as stale
|
|
|
|
*
|
|
|
|
* This fixes some problems with bad files acquired because of unhandled HTTP redirects
|
|
|
|
* in old versions of MultiMC.
|
|
|
|
*/
|
|
|
|
if (!entry->stale)
|
|
|
|
{
|
|
|
|
QFileInfo localFile(entry->getFullPath());
|
|
|
|
if (localFile.size() <= 0x4000)
|
|
|
|
{
|
|
|
|
entry->stale = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-23 05:57:40 +05:30
|
|
|
if (entry->stale)
|
|
|
|
{
|
|
|
|
NetJob *fjob = new NetJob("Forge download");
|
|
|
|
fjob->addNetAction(CacheDownload::make(forgeVersion->url(), entry));
|
2015-07-26 21:25:29 +05:30
|
|
|
connect(fjob, &NetJob::progress, this, &Task::setProgress);
|
|
|
|
connect(fjob, &NetJob::status, this, &Task::setStatus);
|
2015-04-27 02:34:50 +05:30
|
|
|
connect(fjob, &NetJob::failed, [this](QString reason)
|
2015-05-05 05:03:34 +05:30
|
|
|
{ emitFailed(tr("Failure to download Forge:\n%1").arg(reason)); });
|
2014-04-23 05:57:40 +05:30
|
|
|
connect(fjob, &NetJob::succeeded, installFunction);
|
|
|
|
fjob->start();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
installFunction();
|
2014-03-15 01:18:57 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
bool install(const std::shared_ptr<MetaEntry> &entry, const ForgeVersionPtr &forgeVersion)
|
|
|
|
{
|
2014-04-23 05:57:40 +05:30
|
|
|
if (forgeVersion->usesInstaller())
|
|
|
|
{
|
|
|
|
QString forgePath = entry->getFullPath();
|
|
|
|
m_installer->prepare(forgePath, forgeVersion->universal_url);
|
|
|
|
return m_installer->add(m_instance);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return m_installer->addLegacy(m_instance);
|
2014-03-15 01:18:57 +05:30
|
|
|
}
|
|
|
|
void reload()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2015-01-28 03:01:07 +05:30
|
|
|
m_instance->reloadProfile();
|
2014-03-15 01:18:57 +05:30
|
|
|
emitSucceeded();
|
|
|
|
}
|
2015-05-28 23:08:29 +05:30
|
|
|
catch (Exception &e)
|
2014-03-15 01:18:57 +05:30
|
|
|
{
|
|
|
|
emitFailed(e.cause());
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
emitFailed(tr("Failed to load the version description file for reasons unknown."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ForgeInstaller *m_installer;
|
|
|
|
OneSixInstance *m_instance;
|
|
|
|
BaseVersionPtr m_version;
|
|
|
|
};
|
|
|
|
|
2015-04-27 02:34:50 +05:30
|
|
|
Task *ForgeInstaller::createInstallTask(OneSixInstance *instance,
|
2014-04-23 05:57:40 +05:30
|
|
|
BaseVersionPtr version, QObject *parent)
|
2014-03-15 01:18:57 +05:30
|
|
|
{
|
2014-04-23 05:57:40 +05:30
|
|
|
if (!version)
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
m_forge_version = std::dynamic_pointer_cast<ForgeVersion>(version);
|
2014-03-15 01:18:57 +05:30
|
|
|
return new ForgeInstallTask(this, instance, version, parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "ForgeInstaller.moc"
|