-
Notifications
You must be signed in to change notification settings - Fork 14
/
BDOFiles-boost.h
129 lines (119 loc) · 3.23 KB
/
BDOFiles-boost.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include <string>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <boost/filesystem.hpp> ///boost headers (for GCC add linker arguments: -lboost_system-mt -lboost_filesystem-mt)
#include "IceKey.h"
#include "BDO.h"
#include "Utility.h"
#include "zlib.h"
namespace BDO
{
struct FileEntry
{
FileEntry(); //constructor
uint32_t uiFileHash;
uint32_t uiFolderNum;
uint32_t uiFileNum;
uint32_t uiPazNum;
uint32_t uiOffset;
uint32_t uiCompressedSize;
uint32_t uiOriginalSize;
std::string sFileName;
std::string sFilePath;
///operator overload for sorting
bool operator<(const FileEntry &a) const
{
return sFilePath < a.sFilePath;
}
};
class BDOFile
: private IceKey
{
public:
///constructor
BDOFile();
///functions
void ExtractFile(boost::filesystem::path FilePath, boost::filesystem::path PazName, uint32_t uiOffset, uint32_t uiCompressedSize, uint32_t uiOriginalSize);
uint32_t ExtractFileMask(std::string sFileMask, boost::filesystem::path OutputPath);
uint32_t List();
uint32_t ListFileMask(std::string sFileMask);
bool GetQuiet();
void SetQuiet(bool bQuiet);
bool GetNoFolders();
void SetNoFolders(bool bNoFolders);
bool GetYesToAll();
void SetYesToAll(bool bYesToAll);
bool GetMobile();
void SetMobile(bool bMobile);
boost::filesystem::path GetArchivePath();
void SetArchivePath(boost::filesystem::path ArchivePath);
protected:
///functions
void ICEdecrypt(uint8_t *encrypted, uint8_t *decrypted, uint32_t dataSize);
void ICEencrypt(uint8_t *decrypted, uint8_t *encrypted, uint32_t dataSize);
void exitError(int errCode, std::string sDetail);
void exitError(int errCode);
boost::filesystem::path GetPazName(uint32_t uiPazNum);
///variables
std::vector<FileEntry> vFilesTable;
std::map<uint32_t, boost::filesystem::path> mPazNames;
private:
///functions
void internalExtractFile(boost::filesystem::path FilePath, boost::filesystem::path PazName, uint32_t uiOffset, uint32_t uiCompressedSize, uint32_t uiOriginalSize);
///variables
bool bQuiet;
bool bNoFolders;
bool bYesToAll;
bool bRenameFiles;
bool bOverwriteFiles;
bool bCreatePath;
bool bMobile;
boost::filesystem::path ArchivePath;
};
class MetaFile
: public BDOFile
{
public:
///constructors
MetaFile();
MetaFile(boost::filesystem::path FileName, bool bQuiet);
///functions
uint32_t GetClientVersion();
uint32_t GetFilesCount();
uint32_t GetFileNamesCount();
uint32_t GetFoldersCount();
protected:
///functions
void ReadSource(boost::filesystem::path FileName);
private:
///variables
uint32_t uiClientVersion;
uint32_t uiFilesCount;
uint32_t uiFileNamesCount;
uint32_t uiFoldersCount;
};
class PazFile
: public BDOFile
{
public:
///constructors
PazFile();
PazFile(boost::filesystem::path FileName, bool bQuiet);
///functions
uint32_t GetPazHash();
uint32_t GetFilesCount();
protected:
///functions
void ReadSource(boost::filesystem::path FileName);
private:
///variables
uint32_t uiPazHash;
uint32_t uiFilesCount;
};
}