blob: 41713cf05a1af4e9ec134ec455ebcb6d383f7906 (
plain) (
blame)
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=====================================================================================//
#pragma once
#include <stdio.h>
#include "utlbuffer.h"
#include "zip_uncompressed.h"
#include "generichash.h"
#include "zip_utils.h"
#include "byteswap.h"
#include "tier1/UtlVector.h"
#include "UtlSortVector.h"
struct CRCEntry_t
{
unsigned int fileNameCRC;
CUtlString filename;
};
struct preloadRemap_t
{
CUtlString filename;
unsigned short preloadDirIndex;
};
class CZipCRCLessFunc
{
public:
bool Less( CRCEntry_t const& src1, CRCEntry_t const& src2, void *pCtx )
{
return ( src1.fileNameCRC < src2.fileNameCRC );
}
};
class CXZipTool
{
public:
CXZipTool();
~CXZipTool();
void Reset();
bool Begin( const char* pFileName, unsigned int alignment = 0 );
bool End();
bool AddBuffer( const char* pFileName, CUtlBuffer &buffer, bool bPreload = true );
bool AddFile( const char* pFileName, bool bPreload = true );
void SpewPreloadInfo( const char *pZipName );
private:
IZip *m_pZip;
char m_PreloadFilename[MAX_PATH];
HANDLE m_hPreloadFile;
HANDLE m_hOutputZipFile;
ZIP_PreloadHeader m_ZipPreloadHeader;
CUtlVector< ZIP_PreloadDirectoryEntry > m_ZipPreloadDirectoryEntries;
CUtlSortVector< CRCEntry_t, CZipCRCLessFunc > m_ZipCRCList;
CUtlVector< preloadRemap_t > m_ZipPreloadRemapEntries;
};
|