-
Notifications
You must be signed in to change notification settings - Fork 1
/
KXRUnpacker.h
69 lines (54 loc) · 1.32 KB
/
KXRUnpacker.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
#pragma once
#include <string>
#include <vector>
#include <filesystem>
#include "KBuffer.hpp"
#include "PackageManager.h"
#define KXRF_Identifier ( 'k' << 24 | 'x' << 16 | 'r' << 8 | 'f' )
class KXRUnpacker
{
enum KType
{
TypeFileEncrypted = 0,
TypeDirectory = 1,
TypeFileCompressed = 4,
};
public:
KXRUnpacker()
{
_currentDirectory.clear();
_outputDirectory.clear();
}
KXRUnpacker( std::filesystem::path operating_directory )
{
if( operating_directory.is_absolute() )
{
_outputDirectory = operating_directory;
}
else
{
_outputDirectory = std::filesystem::current_path() / operating_directory;
}
}
~KXRUnpacker()
{
}
void ExtractKXRFile( std::string filename );
void RecursiveKXRExtract();
void UnpackFolder( std::filesystem::path folder_name );
void UnpackEncryptedFile( std::filesystem::path file_name );
void UnpackCompressedFile( std::filesystem::path file_name );
bool SetOutputDirectory( std::filesystem::path path );
void SaveToDisk( std::filesystem::path file_path, KBuffer buffer );
bool LoadPackageJson( std::string filename )
{
return Package.ReadPKGJson( filename );
}
private:
PackageManager Package;
std::filesystem::path _outputDirectory;
std::filesystem::path _currentDirectory;
KBuffer _kxrContentBuffer;
KBuffer _kxrContentTable;
std::string _kxrFileName;
};