2022-05-29 04:08:55 +05:30
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
2021-12-18 05:37:57 +05:30
|
|
|
/*
|
2022-05-29 04:08:55 +05:30
|
|
|
* PolyMC - Minecraft Launcher
|
|
|
|
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
2022-06-03 13:15:09 +05:30
|
|
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
2021-12-18 05:37:57 +05:30
|
|
|
*
|
2022-05-29 04:08:55 +05:30
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
2021-12-18 05:37:57 +05:30
|
|
|
*
|
2022-05-29 04:08:55 +05:30
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2021-12-18 05:37:57 +05:30
|
|
|
*
|
2022-05-29 04:08:55 +05:30
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following copyright and
|
|
|
|
* permission notice:
|
|
|
|
*
|
|
|
|
* Copyright 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
|
|
|
|
* Copyright 2020-2021 Petr Mrazek <peterix@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
2021-12-18 05:37:57 +05:30
|
|
|
*/
|
|
|
|
|
2020-08-21 06:10:19 +05:30
|
|
|
#include "FTBPackInstallTask.h"
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
|
|
|
|
#include "FileSystem.h"
|
|
|
|
#include "Json.h"
|
|
|
|
#include "minecraft/MinecraftInstance.h"
|
|
|
|
#include "minecraft/PackProfile.h"
|
2022-06-03 00:53:20 +05:30
|
|
|
#include "modplatform/flame/PackManifest.h"
|
2021-06-29 02:39:52 +05:30
|
|
|
#include "net/ChecksumValidator.h"
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
#include "settings/INISettingsObject.h"
|
|
|
|
|
2021-11-22 03:51:12 +05:30
|
|
|
#include "BuildConfig.h"
|
|
|
|
#include "Application.h"
|
2022-06-03 00:53:20 +05:30
|
|
|
#include "ui/dialogs/ScrollMessageBox.h"
|
2021-11-22 03:51:12 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
namespace ModpacksCH {
|
|
|
|
|
2022-06-03 00:53:20 +05:30
|
|
|
PackInstallTask::PackInstallTask(Modpack pack, QString version, QWidget* parent)
|
2022-07-26 01:08:58 +05:30
|
|
|
: m_pack(std::move(pack)), m_version_name(std::move(version)), m_parent(parent)
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PackInstallTask::abort()
|
|
|
|
{
|
2022-07-26 01:08:58 +05:30
|
|
|
bool aborted = true;
|
|
|
|
|
|
|
|
if (jobPtr)
|
|
|
|
aborted &= jobPtr->abort();
|
|
|
|
if (modIdResolver)
|
|
|
|
aborted &= modIdResolver->abort();
|
|
|
|
|
|
|
|
// FIXME: This should be 'emitAborted()', but InstanceStaging doesn't connect to the abort signal yet...
|
|
|
|
if (aborted)
|
|
|
|
emitFailed(tr("Aborted"));
|
|
|
|
|
|
|
|
return aborted;
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void PackInstallTask::executeTask()
|
|
|
|
{
|
2022-07-26 01:08:58 +05:30
|
|
|
setStatus(tr("Getting the manifest..."));
|
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
// Find pack version
|
|
|
|
bool found = false;
|
|
|
|
VersionInfo version;
|
|
|
|
|
|
|
|
for(auto vInfo : m_pack.versions) {
|
|
|
|
if (vInfo.name == m_version_name) {
|
|
|
|
found = true;
|
|
|
|
version = vInfo;
|
2021-02-25 19:25:26 +05:30
|
|
|
break;
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!found) {
|
2021-04-08 23:16:22 +05:30
|
|
|
emitFailed(tr("Failed to find pack version %1").arg(m_version_name));
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-31 09:57:59 +05:30
|
|
|
auto *netJob = new NetJob("ModpacksCH::VersionFetch", APPLICATION->network());
|
2022-07-26 01:08:58 +05:30
|
|
|
|
2021-12-31 09:57:59 +05:30
|
|
|
auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1/%2").arg(m_pack.id).arg(version.id);
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
2022-07-26 01:08:58 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
jobPtr = netJob;
|
|
|
|
|
|
|
|
QObject::connect(netJob, &NetJob::succeeded, this, &PackInstallTask::onDownloadSucceeded);
|
|
|
|
QObject::connect(netJob, &NetJob::failed, this, &PackInstallTask::onDownloadFailed);
|
2022-07-26 01:08:58 +05:30
|
|
|
QObject::connect(netJob, &NetJob::progress, this, &PackInstallTask::setProgress);
|
|
|
|
|
|
|
|
jobPtr->start();
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void PackInstallTask::onDownloadSucceeded()
|
|
|
|
{
|
|
|
|
jobPtr.reset();
|
|
|
|
|
|
|
|
QJsonParseError parse_error;
|
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error);
|
|
|
|
if(parse_error.error != QJsonParseError::NoError) {
|
2022-05-02 20:18:12 +05:30
|
|
|
qWarning() << "Error while parsing JSON response from ModpacksCH at " << parse_error.offset << " reason: " << parse_error.errorString();
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
qWarning() << response;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto obj = doc.object();
|
|
|
|
|
|
|
|
ModpacksCH::Version version;
|
2022-07-26 01:08:58 +05:30
|
|
|
try {
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
ModpacksCH::loadVersion(version, obj);
|
2022-07-26 01:08:58 +05:30
|
|
|
} catch (const JSONValidationError &e) {
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
emitFailed(tr("Could not understand pack manifest:\n") + e.cause());
|
|
|
|
return;
|
|
|
|
}
|
2022-07-26 01:08:58 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
m_version = version;
|
|
|
|
|
2022-06-03 00:53:20 +05:30
|
|
|
resolveMods();
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void PackInstallTask::onDownloadFailed(QString reason)
|
|
|
|
{
|
|
|
|
jobPtr.reset();
|
2022-07-26 01:08:58 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
emitFailed(reason);
|
|
|
|
}
|
|
|
|
|
2022-06-03 00:53:20 +05:30
|
|
|
void PackInstallTask::resolveMods()
|
|
|
|
{
|
|
|
|
setStatus(tr("Resolving mods..."));
|
2022-07-26 01:08:58 +05:30
|
|
|
setProgress(0, 100);
|
2022-06-03 00:53:20 +05:30
|
|
|
|
|
|
|
indexFileIdMap.clear();
|
2022-07-26 01:08:58 +05:30
|
|
|
|
|
|
|
Flame::Manifest manifest;
|
2022-06-03 00:53:20 +05:30
|
|
|
int index = 0;
|
2022-07-26 01:08:58 +05:30
|
|
|
|
|
|
|
for(auto const& file : m_version.files) {
|
2022-06-03 00:53:20 +05:30
|
|
|
if(!file.serverOnly && file.url.isEmpty()) {
|
2022-07-26 01:08:58 +05:30
|
|
|
if(file.curseforge.file <= 0) {
|
|
|
|
emitFailed(QString("Invalid manifest: There's no information available to download the file '%1'!").arg(file.name));
|
|
|
|
return;
|
|
|
|
}
|
2022-06-03 00:53:20 +05:30
|
|
|
|
2022-07-26 01:08:58 +05:30
|
|
|
Flame::File flame_file;
|
|
|
|
flame_file.projectId = file.curseforge.project;
|
|
|
|
flame_file.fileId = file.curseforge.file;
|
|
|
|
flame_file.hash = file.sha1;
|
2022-06-03 00:53:20 +05:30
|
|
|
|
|
|
|
|
2022-07-26 01:08:58 +05:30
|
|
|
manifest.files.insert(flame_file.fileId, flame_file);
|
|
|
|
indexFileIdMap.insert(index, flame_file.fileId);
|
2022-06-03 00:53:20 +05:30
|
|
|
}
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
modIdResolver = new Flame::FileResolvingTask(APPLICATION->network(), manifest);
|
|
|
|
|
|
|
|
connect(modIdResolver.get(), &Flame::FileResolvingTask::succeeded, this, [&]()
|
|
|
|
{
|
2022-07-26 01:08:58 +05:30
|
|
|
m_abortable = false;
|
2022-06-03 00:53:20 +05:30
|
|
|
|
|
|
|
QString text;
|
|
|
|
auto anyBlocked = false;
|
|
|
|
|
|
|
|
Flame::Manifest results = modIdResolver->getResults();
|
2022-07-26 01:08:58 +05:30
|
|
|
for (auto index : indexFileIdMap.keys()) {
|
|
|
|
int fileId = indexFileIdMap.constFind(index).value();
|
|
|
|
|
|
|
|
Flame::File results_file = results.files[fileId];
|
|
|
|
VersionFile& local_file = m_version.files[index];
|
|
|
|
|
|
|
|
// First check for blocked mods
|
|
|
|
if (!results_file.resolved || results_file.url.isEmpty()) {
|
|
|
|
QString type(local_file.type);
|
|
|
|
|
2022-06-03 00:53:20 +05:30
|
|
|
type[0] = type[0].toUpper();
|
2022-07-26 01:08:58 +05:30
|
|
|
text += QString("%1: %2 - <a href='%3'>%3</a><br/>").arg(type, local_file.name, results_file.websiteUrl);
|
2022-06-03 00:53:20 +05:30
|
|
|
anyBlocked = true;
|
|
|
|
} else {
|
2022-07-26 01:08:58 +05:30
|
|
|
local_file.url = results_file.url.toString();
|
2022-06-03 00:53:20 +05:30
|
|
|
}
|
|
|
|
}
|
2022-07-26 01:08:58 +05:30
|
|
|
|
|
|
|
if (anyBlocked) {
|
|
|
|
qDebug() << "Blocked files found, displaying file list";
|
2022-06-03 00:53:20 +05:30
|
|
|
|
|
|
|
auto message_dialog = new ScrollMessageBox(m_parent,
|
|
|
|
tr("Blocked files found"),
|
|
|
|
tr("The following files are not available for download in third party launchers.<br/>"
|
|
|
|
"You will need to manually download them and add them to the instance."),
|
|
|
|
text);
|
2022-07-26 01:08:58 +05:30
|
|
|
if (message_dialog->exec() == QDialog::Accepted) {
|
2022-06-03 00:53:20 +05:30
|
|
|
modIdResolver.reset();
|
|
|
|
downloadPack();
|
2022-07-26 01:08:58 +05:30
|
|
|
} else {
|
|
|
|
modIdResolver.reset();
|
|
|
|
abort();
|
|
|
|
return;
|
|
|
|
}
|
2022-06-03 00:53:20 +05:30
|
|
|
} else {
|
|
|
|
modIdResolver.reset();
|
|
|
|
downloadPack();
|
|
|
|
}
|
|
|
|
});
|
2022-07-26 01:08:58 +05:30
|
|
|
|
2022-06-03 00:53:20 +05:30
|
|
|
connect(modIdResolver.get(), &Flame::FileResolvingTask::failed, this, &PackInstallTask::onDownloadFailed);
|
2022-07-26 01:08:58 +05:30
|
|
|
connect(modIdResolver.get(), &Flame::FileResolvingTask::progress, this, &PackInstallTask::setProgress);
|
2022-06-03 00:53:20 +05:30
|
|
|
|
|
|
|
modIdResolver->start();
|
|
|
|
}
|
|
|
|
|
2021-02-25 20:04:51 +05:30
|
|
|
void PackInstallTask::downloadPack()
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
{
|
2021-02-25 20:04:51 +05:30
|
|
|
setStatus(tr("Downloading mods..."));
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
|
2021-12-31 09:57:59 +05:30
|
|
|
jobPtr = new NetJob(tr("Mod download"), APPLICATION->network());
|
2022-07-26 01:08:58 +05:30
|
|
|
for (auto const& file : m_version.files) {
|
|
|
|
if (file.serverOnly || file.url.isEmpty())
|
|
|
|
continue;
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
|
2022-07-26 01:08:58 +05:30
|
|
|
QFileInfo file_info(file.name);
|
|
|
|
auto cacheName = file_info.completeBaseName() + "-" + file.sha1 + "." + file_info.suffix();
|
2021-06-29 03:04:38 +05:30
|
|
|
|
2021-11-22 03:51:12 +05:30
|
|
|
auto entry = APPLICATION->metacache()->resolveEntry("ModpacksCHPacks", cacheName);
|
2021-06-29 03:04:38 +05:30
|
|
|
entry->setStale(true);
|
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
auto relpath = FS::PathCombine("minecraft", file.path, file.name);
|
2020-11-14 23:36:27 +05:30
|
|
|
auto path = FS::PathCombine(m_stagingPath, relpath);
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
|
2021-09-23 05:22:10 +05:30
|
|
|
if (filesToCopy.contains(path)) {
|
2021-09-17 20:30:43 +05:30
|
|
|
qWarning() << "Ignoring" << file.url << "as a file of that path is already downloading.";
|
|
|
|
continue;
|
|
|
|
}
|
2022-07-26 01:08:58 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
qDebug() << "Will download" << file.url << "to" << path;
|
2021-09-23 05:22:10 +05:30
|
|
|
filesToCopy[path] = entry->getFullPath();
|
2021-06-29 03:04:38 +05:30
|
|
|
|
|
|
|
auto dl = Net::Download::makeCached(file.url, entry);
|
2021-06-29 02:39:52 +05:30
|
|
|
if (!file.sha1.isEmpty()) {
|
|
|
|
auto rawSha1 = QByteArray::fromHex(file.sha1.toLatin1());
|
|
|
|
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1));
|
|
|
|
}
|
2022-07-26 01:08:58 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
jobPtr->addNetAction(dl);
|
|
|
|
}
|
2020-10-12 03:13:39 +05:30
|
|
|
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
connect(jobPtr.get(), &NetJob::succeeded, this, [&]()
|
|
|
|
{
|
|
|
|
jobPtr.reset();
|
2021-02-25 20:04:51 +05:30
|
|
|
install();
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
});
|
|
|
|
connect(jobPtr.get(), &NetJob::failed, [&](QString reason)
|
|
|
|
{
|
|
|
|
jobPtr.reset();
|
2021-06-03 19:46:03 +05:30
|
|
|
emitFailed(reason);
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
});
|
2022-07-26 01:08:58 +05:30
|
|
|
connect(jobPtr.get(), &NetJob::progress, this, &PackInstallTask::setProgress);
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
|
2021-12-31 09:57:59 +05:30
|
|
|
jobPtr->start();
|
2022-07-26 01:08:58 +05:30
|
|
|
|
|
|
|
m_abortable = true;
|
2021-02-25 20:04:51 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void PackInstallTask::install()
|
|
|
|
{
|
2022-07-26 01:08:58 +05:30
|
|
|
m_abortable = false;
|
|
|
|
|
2021-06-29 03:04:38 +05:30
|
|
|
setStatus(tr("Copying modpack files"));
|
|
|
|
|
2022-07-26 01:08:58 +05:30
|
|
|
for (auto iter = filesToCopy.cbegin(); iter != filesToCopy.cend(); iter++) {
|
|
|
|
auto& to = iter.key();
|
|
|
|
auto& from = iter.value();
|
2021-06-29 03:04:38 +05:30
|
|
|
FS::copy fileCopyOperation(from, to);
|
|
|
|
if(!fileCopyOperation()) {
|
|
|
|
qWarning() << "Failed to copy" << from << "to" << to;
|
|
|
|
emitFailed(tr("Failed to copy files"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-25 20:04:51 +05:30
|
|
|
setStatus(tr("Installing modpack"));
|
|
|
|
|
|
|
|
auto instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg");
|
|
|
|
auto instanceSettings = std::make_shared<INISettingsObject>(instanceConfigPath);
|
|
|
|
instanceSettings->suspendSave();
|
|
|
|
|
|
|
|
MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
|
|
|
|
auto components = instance.getPackProfile();
|
|
|
|
components->buildingFromScratch();
|
|
|
|
|
|
|
|
for(auto target : m_version.targets) {
|
|
|
|
if(target.type == "game" && target.name == "minecraft") {
|
|
|
|
components->setComponentVersion("net.minecraft", target.version, true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(auto target : m_version.targets) {
|
|
|
|
if(target.type != "modloader") continue;
|
|
|
|
|
|
|
|
if(target.name == "forge") {
|
2022-07-07 13:26:28 +05:30
|
|
|
components->setComponentVersion("net.minecraftforge", target.version);
|
2021-02-25 20:04:51 +05:30
|
|
|
}
|
|
|
|
else if(target.name == "fabric") {
|
2022-07-07 13:26:28 +05:30
|
|
|
components->setComponentVersion("net.fabricmc.fabric-loader", target.version);
|
2021-02-25 20:04:51 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-25 20:13:04 +05:30
|
|
|
// install any jar mods
|
|
|
|
QDir jarModsDir(FS::PathCombine(m_stagingPath, "minecraft", "jarmods"));
|
|
|
|
if (jarModsDir.exists()) {
|
|
|
|
QStringList jarMods;
|
|
|
|
|
|
|
|
for (const auto& info : jarModsDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files)) {
|
|
|
|
jarMods.push_back(info.absoluteFilePath());
|
|
|
|
}
|
|
|
|
|
|
|
|
components->installJarMods(jarMods);
|
|
|
|
}
|
|
|
|
|
2021-02-25 20:04:51 +05:30
|
|
|
components->saveNow();
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
|
|
|
|
instance.setName(m_instName);
|
|
|
|
instance.setIconKey(m_instIcon);
|
2022-05-29 04:08:55 +05:30
|
|
|
instance.setManagedPack("modpacksch", QString::number(m_pack.id), m_pack.name, QString::number(m_version.id), m_version.name);
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
instanceSettings->resumeSave();
|
2021-02-25 20:04:51 +05:30
|
|
|
|
|
|
|
emitSucceeded();
|
GH-3095 New FTB platform support
Models are based on the models from my go-modpacksch library.
License:
========
The MIT License (MIT)
Copyright (c) Jamie Mansfield <https://www.jamiemansfield.me/>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2020-06-07 20:44:47 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|