NOISSUE continue refactoring things to make tests pass
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
#include <Env.h>
|
||||
#include <quazip.h>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <MMCZip.h>
|
||||
#include <minecraft/OneSixVersionFormat.h>
|
||||
#include <Version.h>
|
||||
#include <net/ChecksumValidator.h>
|
||||
#include "ATLPackInstallTask.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
#include <quazip.h>
|
||||
|
||||
#include "MMCZip.h"
|
||||
#include "minecraft/OneSixVersionFormat.h"
|
||||
#include "Version.h"
|
||||
#include "net/ChecksumValidator.h"
|
||||
#include "FileSystem.h"
|
||||
#include "Json.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
@ -17,6 +17,9 @@
|
||||
#include "meta/Version.h"
|
||||
#include "meta/VersionList.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
#include "Application.h"
|
||||
|
||||
namespace ATLauncher {
|
||||
|
||||
PackInstallTask::PackInstallTask(UserInteractionSupport *support, QString pack, QString version)
|
||||
@ -43,7 +46,7 @@ void PackInstallTask::executeTask()
|
||||
.arg(m_pack).arg(m_version_name);
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start();
|
||||
jobPtr->start(APPLICATION->network());
|
||||
|
||||
QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded);
|
||||
QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onDownloadFailed);
|
||||
@ -76,7 +79,7 @@ void PackInstallTask::onDownloadSucceeded()
|
||||
}
|
||||
m_version = version;
|
||||
|
||||
auto vlist = ENV->metadataIndex()->get("net.minecraft");
|
||||
auto vlist = APPLICATION->metadataIndex()->get("net.minecraft");
|
||||
if(!vlist)
|
||||
{
|
||||
emitFailed(tr("Failed to get local metadata index for %1").arg("net.minecraft"));
|
||||
@ -157,7 +160,7 @@ QString PackInstallTask::getDirForModType(ModType type, QString raw)
|
||||
QString PackInstallTask::getVersionForLoader(QString uid)
|
||||
{
|
||||
if(m_version.loader.recommended || m_version.loader.latest || m_version.loader.choose) {
|
||||
auto vlist = ENV->metadataIndex()->get(uid);
|
||||
auto vlist = APPLICATION->metadataIndex()->get(uid);
|
||||
if(!vlist)
|
||||
{
|
||||
emitFailed(tr("Failed to get local metadata index for %1").arg(uid));
|
||||
@ -409,7 +412,7 @@ void PackInstallTask::installConfigs()
|
||||
auto path = QString("Configs/%1/%2.zip").arg(m_pack).arg(m_version_name);
|
||||
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "packs/%1/versions/%2/Configs.zip")
|
||||
.arg(m_pack).arg(m_version_name);
|
||||
auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", path);
|
||||
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", path);
|
||||
entry->setStale(true);
|
||||
|
||||
auto dl = Net::Download::makeCached(url, entry);
|
||||
@ -438,7 +441,7 @@ void PackInstallTask::installConfigs()
|
||||
setProgress(current, total);
|
||||
});
|
||||
|
||||
jobPtr->start();
|
||||
jobPtr->start(APPLICATION->network());
|
||||
}
|
||||
|
||||
void PackInstallTask::extractConfigs()
|
||||
@ -516,7 +519,7 @@ void PackInstallTask::downloadMods()
|
||||
auto cacheName = fileName.completeBaseName() + "-" + mod.md5 + "." + fileName.suffix();
|
||||
|
||||
if (mod.type == ModType::Extract || mod.type == ModType::TexturePackExtract || mod.type == ModType::ResourcePackExtract) {
|
||||
auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", cacheName);
|
||||
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", cacheName);
|
||||
entry->setStale(true);
|
||||
modsToExtract.insert(entry->getFullPath(), mod);
|
||||
|
||||
@ -528,7 +531,7 @@ void PackInstallTask::downloadMods()
|
||||
jobPtr->addNetAction(dl);
|
||||
}
|
||||
else if(mod.type == ModType::Decomp) {
|
||||
auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", cacheName);
|
||||
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", cacheName);
|
||||
entry->setStale(true);
|
||||
modsToDecomp.insert(entry->getFullPath(), mod);
|
||||
|
||||
@ -543,7 +546,7 @@ void PackInstallTask::downloadMods()
|
||||
auto relpath = getDirForModType(mod.type, mod.type_raw);
|
||||
if(relpath == Q_NULLPTR) continue;
|
||||
|
||||
auto entry = ENV->metacache()->resolveEntry("ATLauncherPacks", cacheName);
|
||||
auto entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", cacheName);
|
||||
entry->setStale(true);
|
||||
|
||||
auto dl = Net::Download::makeCached(url, entry);
|
||||
@ -558,7 +561,7 @@ void PackInstallTask::downloadMods()
|
||||
modsToCopy[entry->getFullPath()] = path;
|
||||
|
||||
if(mod.type == ModType::Forge) {
|
||||
auto vlist = ENV->metadataIndex()->get("net.minecraftforge");
|
||||
auto vlist = APPLICATION->metadataIndex()->get("net.minecraftforge");
|
||||
if(vlist)
|
||||
{
|
||||
auto ver = vlist->getVersion(mod.version);
|
||||
@ -593,7 +596,7 @@ void PackInstallTask::downloadMods()
|
||||
setProgress(current, total);
|
||||
});
|
||||
|
||||
jobPtr->start();
|
||||
jobPtr->start(APPLICATION->network());
|
||||
}
|
||||
|
||||
void PackInstallTask::onModsDownloaded() {
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
|
||||
bool abortable = false;
|
||||
|
||||
NetJobPtr jobPtr;
|
||||
NetJob::Ptr jobPtr;
|
||||
QByteArray response;
|
||||
|
||||
QString m_pack;
|
||||
|
Reference in New Issue
Block a user