aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/ArchiveFile.h
blob: 722d570d83bfeaa47073a3e60f1e7015b6651837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include <vector>
#include <unordered_map>

#include "..\Minecraft.World\File.h"
#include "..\Minecraft.World\ArrayWithLength.h"

using namespace std;

class ArchiveFile
{
protected:
	File m_sourcefile;
	BYTE *m_cachedData;

	typedef struct _MetaData
	{
		wstring filename;
		int ptr;
		int filesize;
		bool isCompressed;

	} MetaData, *PMetaData;
	
	unordered_map<wstring, PMetaData> m_index;
	
public:
	void _readHeader(DataInputStream *dis);

	ArchiveFile(File file);
	~ArchiveFile();

	vector<wstring> *getFileList();
	bool hasFile(const wstring &filename);
	int getFileSize(const wstring &filename);
	byteArray getFile(const wstring &filename);
};