2022-08-29 07:03:44 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include "minecraft/mod/ResourcePack.h"
|
|
|
|
|
|
|
|
#include "tasks/Task.h"
|
|
|
|
|
|
|
|
class LocalResourcePackParseTask : public Task {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LocalResourcePackParseTask(int token, ResourcePack& rp);
|
|
|
|
|
|
|
|
[[nodiscard]] bool canAbort() const override { return true; }
|
|
|
|
bool abort() override;
|
|
|
|
|
|
|
|
void executeTask() override;
|
|
|
|
|
|
|
|
[[nodiscard]] int token() const { return m_token; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
void processMCMeta(QByteArray&& raw_data);
|
2022-08-29 17:45:06 +05:30
|
|
|
void processPackPNG(QByteArray&& raw_data);
|
2022-08-29 07:03:44 +05:30
|
|
|
|
|
|
|
void processAsFolder();
|
|
|
|
void processAsZip();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_token;
|
|
|
|
|
|
|
|
ResourcePack& m_resource_pack;
|
|
|
|
|
|
|
|
bool m_aborted = false;
|
|
|
|
};
|