project64/Source/Project64/3rd Party/7zip.h

77 lines
2.3 KiB
C
Raw Normal View History

2012-11-19 11:04:57 +00:00
#pragma once
2015-02-28 05:05:57 +00:00
#include <string>
#ifdef __cplusplus
extern "C" {
#endif
#include "7zip\7zCrc.h"
2015-02-28 05:05:57 +00:00
#include "7zip\7z.h"
#include "7zip\7zFile.h"
#include "7zip\Types.h"
#ifdef __cplusplus
}
#endif
class C7zip
{
public:
2012-11-19 11:04:57 +00:00
C7zip (LPCSTR FileName);
~C7zip ();
typedef void (__stdcall *LP7ZNOTIFICATION)( LPCWSTR Status, void * CBInfo );
2015-02-28 05:05:57 +00:00
inline int NumFiles ( void ) const { return m_db ? m_db->db.NumFiles : 0; }
inline CSzFileItem * FileItem ( int index ) const { return m_db ? &m_db->db.Files[index] : NULL; }
inline int FileSize ( void ) const { return m_FileSize; }
inline bool OpenSuccess ( void) const { return m_Opened; }
2012-11-19 11:04:57 +00:00
bool GetFile ( int index, Byte * Data, size_t DataLen );
const char * FileName ( char * FileName, int SizeOfFileName ) const;
std::wstring FileNameIndex (int index);
2012-11-19 11:04:57 +00:00
void SetNotificationCallback (LP7ZNOTIFICATION NotfyFnc, void * CBInfo);
private:
2012-11-19 11:04:57 +00:00
C7zip(void); // Disable default constructor
C7zip(const C7zip&); // Disable copy constructor
C7zip& operator=(const C7zip&); // Disable assignment
2015-02-28 05:05:57 +00:00
/*typedef struct _CFileInStream
{
ISzInStream InStream;
FILE *File;
} CFileInStream;
2015-02-28 05:05:57 +00:00
*/
CSzArEx * m_db;
CFileInStream m_archiveStream;
2015-02-28 05:05:57 +00:00
CLookToRead m_archiveLookStream;
ISzAlloc m_allocImp;
ISzAlloc m_allocTempImp;
int m_FileSize;
char m_FileName[260];
int m_CurrentFile;
2015-02-28 05:05:57 +00:00
bool m_Opened;
//Used for extraction
UInt32 m_blockIndex ; // it can have any value before first call (if outBuffer = 0)
Byte * m_outBuffer; // it must be 0 before first call for each new archive.
size_t m_outBufferSize; // it can have any value before first call (if outBuffer = 0)
2015-02-28 05:05:57 +00:00
static void * AllocAllocImp (void *p, size_t size);
static void AllocFreeImp (void *p, void *address); /* address can be 0 */
static SRes SzFileReadImp(void *object, void *buffer, size_t *processedSize);
static SRes SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin);
2015-02-28 05:05:57 +00:00
//static void __stdcall StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _this);
static void __stdcall NotfyCallbackDefault ( LPCWSTR /*Status*/, void * /*CBInfo*/ ) { }
2012-11-19 11:04:57 +00:00
LP7ZNOTIFICATION m_NotfyCallback;
void * m_NotfyCallbackInfo;
};