2019-02-13 14:10:36 -05:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
class ArchiveReader
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
bool _initialized = false;
|
|
|
|
uint8_t* _buffer = nullptr;
|
|
|
|
virtual bool InternalLoadArchive(void* buffer, size_t size) = 0;
|
|
|
|
virtual vector<string> InternalGetFileList() = 0;
|
|
|
|
public:
|
|
|
|
~ArchiveReader();
|
|
|
|
|
|
|
|
bool LoadArchive(void* buffer, size_t size);
|
|
|
|
bool LoadArchive(vector<uint8_t>& data);
|
|
|
|
bool LoadArchive(string filename);
|
2021-03-10 11:13:28 -05:00
|
|
|
bool LoadArchive(std::istream &in);
|
2019-02-13 14:10:36 -05:00
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
bool GetStream(string filename, std::stringstream &stream);
|
2019-02-13 14:10:36 -05:00
|
|
|
|
|
|
|
vector<string> GetFileList(std::initializer_list<string> extensions = {});
|
|
|
|
bool CheckFile(string filename);
|
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
virtual bool ExtractFile(string filename, vector<uint8_t> &output) = 0;
|
2019-02-13 14:10:36 -05:00
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
static shared_ptr<ArchiveReader> GetReader(std::istream &in);
|
2019-02-13 14:10:36 -05:00
|
|
|
static shared_ptr<ArchiveReader> GetReader(string filepath);
|
2021-03-10 11:13:28 -05:00
|
|
|
};
|