PrismLauncher/launcher/minecraft/mod/tasks/LocalModParseTask.h
flow e7cf9932a9
refactor: simplify Mod structure
No need to keep track of pointers left and right. A single one already
gives enough headaches!

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:51 -03:00

39 lines
739 B
C++

#pragma once
#include <QDebug>
#include <QObject>
#include "minecraft/mod/Mod.h"
#include "minecraft/mod/ModDetails.h"
#include "tasks/Task.h"
class LocalModParseTask : public Task
{
Q_OBJECT
public:
struct Result {
ModDetails details;
};
using ResultPtr = std::shared_ptr<Result>;
ResultPtr result() const {
return m_result;
}
LocalModParseTask(int token, ResourceType type, const QFileInfo & modFile);
void executeTask() override;
[[nodiscard]] int token() const { return m_token; }
private:
void processAsZip();
void processAsFolder();
void processAsLitemod();
private:
int m_token;
ResourceType m_type;
QFileInfo m_modFile;
ResultPtr m_result;
};