TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ListFile.h
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* ListFile.h Copyright (c) Ladislav Zezula 2014 */
3 /*---------------------------------------------------------------------------*/
4 /* Common functions for CascLib */
5 /*---------------------------------------------------------------------------*/
6 /* Date Ver Who Comment */
7 /* -------- ---- --- ------- */
8 /* 10.05.14 1.00 Lad The first version of ListFile.h */
9 /*****************************************************************************/
10 
11 #ifndef __LISTFILE_H__
12 #define __LISTFILE_H__
13 
14 //-----------------------------------------------------------------------------
15 // Structures
16 
17 typedef struct _LISTFILE_ENTRY
18 {
19  ULONGLONG FileNameHash; // Hash of the file name
20  DWORD cbEntrySize; // Length of this entry, in bytes
21  char szFileName[1]; // File name, aligned to 8-byte boundary
22 
24 
25 typedef struct _LISTFILE_MAP
26 {
27  PCASC_MAP pNameMap; // Map of hash-to-name
28  size_t cbBufferMax; // Total size of the buffer, in bytes
29  size_t cbBuffer; // Current size of the buffer, in bytes
30  size_t nEntries; // Number of entries
31 
32  // First LISTFILE_ENTRY starts here
33 
35 
36 //-----------------------------------------------------------------------------
37 // Functions for parsing an external listfile
38 
39 void * ListFile_OpenExternal(const TCHAR * szListFile);
40 void * ListFile_FromBuffer(LPBYTE pbBuffer, DWORD cbBuffer);
41 bool ListFile_VerifyMD5(void * pvListFile, LPBYTE pbHashMD5);
42 size_t ListFile_GetNextLine(void * pvListFile, const char ** pszLineBegin, const char ** pszLineEnd);
43 size_t ListFile_GetNextLine(void * pvListFile, char * szBuffer, size_t nMaxChars);
44 size_t ListFile_GetNext(void * pvListFile, const char * szMask, char * szBuffer, size_t nMaxChars);
45 void ListFile_Free(void * pvListFile);
46 
47 //-----------------------------------------------------------------------------
48 // Functions for creating a listfile map
49 
50 PLISTFILE_MAP ListFile_CreateMap(const TCHAR * szListFile);
51 const char * ListFile_FindName(PLISTFILE_MAP pListMap, ULONGLONG FileNameHash);
52 void ListFile_FreeMap(PLISTFILE_MAP pListMap);
53 
54 #endif // __LISTFILE_H__
size_t cbBuffer
Definition: ListFile.h:29
PCASC_MAP pNameMap
Definition: ListFile.h:27
unsigned long long ULONGLONG
Definition: CascPort.h:144
ULONGLONG FileNameHash
Definition: ListFile.h:19
void * ListFile_OpenExternal(const TCHAR *szListFile)
Definition: ListFile.cpp:52
bool ListFile_VerifyMD5(void *pvListFile, LPBYTE pbHashMD5)
Definition: ListFile.cpp:100
char TCHAR
Definition: CascPort.h:148
char szFileName[1]
Definition: ListFile.h:21
size_t ListFile_GetNextLine(void *pvListFile, const char **pszLineBegin, const char **pszLineEnd)
Definition: ListFile.cpp:111
BYTE * LPBYTE
Definition: CascPort.h:152
Definition: ListFile.h:17
void ListFile_Free(void *pvListFile)
Definition: ListFile.cpp:201
struct _LISTFILE_ENTRY * PLISTFILE_ENTRY
size_t ListFile_GetNext(void *pvListFile, const char *szMask, char *szBuffer, size_t nMaxChars)
Definition: ListFile.cpp:172
Definition: ListFile.h:25
unsigned int DWORD
Definition: CascPort.h:139
Definition: Map.h:19
struct _LISTFILE_MAP LISTFILE_MAP
size_t nEntries
Definition: ListFile.h:30
struct _LISTFILE_ENTRY LISTFILE_ENTRY
void ListFile_FreeMap(PLISTFILE_MAP pListMap)
Definition: ListFile.cpp:349
size_t cbBufferMax
Definition: ListFile.h:28
void * ListFile_FromBuffer(LPBYTE pbBuffer, DWORD cbBuffer)
Definition: ListFile.cpp:86
const char * ListFile_FindName(PLISTFILE_MAP pListMap, ULONGLONG FileNameHash)
Definition: ListFile.cpp:340
struct _LISTFILE_MAP * PLISTFILE_MAP
PLISTFILE_MAP ListFile_CreateMap(const TCHAR *szListFile)
Definition: ListFile.cpp:300
DWORD cbEntrySize
Definition: ListFile.h:20