2022-05-10 23:57:47 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
2023-08-04 18:41:47 +01:00
|
|
|
* Prism Launcher - Minecraft Launcher
|
2023-08-02 17:35:35 +01:00
|
|
|
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2022-05-10 23:57:47 +01:00
|
|
|
|
2022-04-16 17:27:29 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "modplatform/packwiz/Packwiz.h"
|
|
|
|
|
|
|
|
// launcher/minecraft/mod/Mod.h
|
|
|
|
class Mod;
|
|
|
|
|
|
|
|
/* Abstraction file for easily changing the way metadata is stored / handled
|
|
|
|
* Needs to be a class because of -Wunused-function and no C++17 [[maybe_unused]]
|
|
|
|
* */
|
|
|
|
class Metadata {
|
|
|
|
public:
|
|
|
|
using ModStruct = Packwiz::V1::Mod;
|
2023-09-10 14:22:57 +01:00
|
|
|
using ModSide = Packwiz::V1::Side;
|
2022-04-16 17:27:29 +01:00
|
|
|
|
|
|
|
static auto create(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> ModStruct
|
|
|
|
{
|
|
|
|
return Packwiz::V1::createModFormat(index_dir, mod_pack, mod_version);
|
|
|
|
}
|
|
|
|
|
2022-06-19 18:26:15 +01:00
|
|
|
static auto create(QDir& index_dir, Mod& internal_mod, QString mod_slug) -> ModStruct
|
2022-04-16 17:27:29 +01:00
|
|
|
{
|
2022-06-19 18:26:15 +01:00
|
|
|
return Packwiz::V1::createModFormat(index_dir, internal_mod, mod_slug);
|
2022-04-16 17:27:29 +01:00
|
|
|
}
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
static void update(QDir& index_dir, ModStruct& mod) { Packwiz::V1::updateModIndex(index_dir, mod); }
|
2022-04-16 17:27:29 +01:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
static void remove(QDir& index_dir, QString mod_slug) { Packwiz::V1::deleteModIndex(index_dir, mod_slug); }
|
2022-04-16 17:27:29 +01:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
static void remove(QDir& index_dir, QVariant& mod_id) { Packwiz::V1::deleteModIndex(index_dir, mod_id); }
|
2022-06-11 21:19:34 +01:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
static auto get(QDir& index_dir, QString mod_slug) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_slug); }
|
2022-06-11 21:19:34 +01:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
static auto get(QDir& index_dir, QVariant& mod_id) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_id); }
|
2022-04-16 17:27:29 +01:00
|
|
|
};
|