forked from shawwwn/H2OExtractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArchive.h
82 lines (68 loc) · 2.17 KB
/
Archive.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
/* Archive.h */
#pragma once
#include "predefine.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <direct.h>
#include <exception>
#include <new> // std::bad_alloc
#include "Types.h"
#include "./Utils/FileUtils.h"
#include "./Utils/StringUtils.h"
#include "./Utils/DebugUtils.h"
#include "./Utils/GeneralUtils.hpp"
#include "ArchiveComment.h"
#include "ArchiveHeader.h"
#include "ArchiveFile.h"
#include "ArchiveFileNameDesc.h"
#include "ArchiveFileNameChunk.h"
#include "ArchiveDirectoryNameDesc.h"
#include "ArchiveDirectoryNameChunk.h"
#include "ArchiveCompressedFileData.h"
#include "./Utils/Blast/blastHandler.h"
class Archive
{
public:
Archive();
Archive(char* szFilePath);
~Archive();
uint64_t readComment(uint64_t streamPos);
uint64_t readHeader(uint64_t streamPos);
uint64_t readFileList(uint64_t streamPos);
uint64_t readFileNameDesc(uint64_t streamPos);
uint64_t readFileNameChunk(uint64_t streamPos);
uint64_t readDirectoryNameDesc(uint64_t streamPos);
uint64_t readDirectoryNameChunk(uint64_t streamPos);
uint64_t readDirectoryParents(uint64_t streamPos);
bool parseStringChunk(ArchiveCompressedStringDesc& desc, ArchiveCompressedStringChunk& chunk,
char*& pCompressedBuffer, std::vector<wchar_t*>& outputVector);
void open(char* szFilePath);
void extractByIndex(uint32_t index);
void extractAll();
void close();
void displayInfo();
// Header
ArchiveComment m_Comment;
ArchiveHeader m_Header;
// Directory Name
ArchiveDirectoryNameDesc m_DirectoryNameDesc;
char* m_pCompressedDirectoryNameChunk; // pointer to the raw(compressed) data from the h2o package
ArchiveDirectoryNameChunk m_DirectoryNameChunk;
std::vector<wchar_t*> m_DirectoryNameList;
// File Name
ArchiveFileNameDesc m_FileNameDesc;
char* m_pCompressedFileNameChunk; // pointer to the raw(compressed) data from the h2o package
ArchiveFileNameChunk m_FileNameChunk;
std::vector<wchar_t*> m_FileNameList;
// Directory Structure
uint32_t m_DirectoryCount;
int32_t* m_arrDirectoryParents;
// File
std::vector<ArchiveFile> m_FileList;
protected:
std::ifstream m_hH2O;
private:
void init();
};