2016-06-17 20:53:05 -04: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);
|
2017-11-19 23:08:23 -05:00
|
|
|
bool LoadArchive(vector<uint8_t>& data);
|
2016-06-17 20:53:05 -04:00
|
|
|
bool LoadArchive(string filename);
|
2017-04-22 13:19:21 -04:00
|
|
|
bool LoadArchive(std::istream &in);
|
|
|
|
|
2017-11-19 23:08:23 -05:00
|
|
|
bool GetStream(string filename, std::stringstream &stream);
|
2016-06-17 20:53:05 -04:00
|
|
|
|
2017-07-30 09:03:54 -04:00
|
|
|
vector<string> GetFileList(std::initializer_list<string> extensions = {});
|
2017-08-19 16:46:57 -04:00
|
|
|
bool CheckFile(string filename);
|
2016-06-17 20:53:05 -04:00
|
|
|
|
2017-07-30 09:03:54 -04:00
|
|
|
virtual bool ExtractFile(string filename, vector<uint8_t> &output) = 0;
|
|
|
|
|
2017-07-30 18:22:55 -04:00
|
|
|
static shared_ptr<ArchiveReader> GetReader(std::istream &in);
|
2017-07-30 09:03:54 -04:00
|
|
|
static shared_ptr<ArchiveReader> GetReader(string filepath);
|
2016-06-17 20:53:05 -04:00
|
|
|
};
|