📄 unzipper.h
字号:
// Unzipper.h: interface for the CUnzipper class (c) daniel godson 2002
//
// CUnzipper is a simple c++ wrapper for the 'unzip' file extraction
// api written by Gilles Vollant (c) 2002, which in turn makes use of
// 'zlib' written by Jean-loup Gailly and Mark Adler (c) 1995-2002.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely without restriction.
//
// Notwithstanding this, you are still bound by the conditions imposed
// by the original authors of 'unzip' and 'zlib'
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_UNZIPPER_H__EBC42716_31C7_4659_8EF3_9BF8D4409709__INCLUDED_)
#define AFX_UNZIPPER_H__EBC42716_31C7_4659_8EF3_9BF8D4409709__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
const UINT MAX_COMMENT = 255;
// create our own fileinfo struct to hide the underlying implementation
//##ModelId=46676C940138
struct UZ_FileInfo
{
//##ModelId=46676C940149
char szFileName[MAX_PATH + 1];
//##ModelId=46676C940157
char szComment[MAX_COMMENT + 1];
//##ModelId=46676C940158
DWORD dwVersion;
//##ModelId=46676C940167
DWORD dwVersionNeeded;
//##ModelId=46676C940168
DWORD dwFlags;
//##ModelId=46676C940177
DWORD dwCompressionMethod;
//##ModelId=46676C940178
DWORD dwDosDate;
//##ModelId=46676C940186
DWORD dwCRC;
//##ModelId=46676C940187
DWORD dwCompressedSize;
//##ModelId=46676C940196
DWORD dwUncompressedSize;
//##ModelId=46676C9401A5
DWORD dwInternalAttrib;
//##ModelId=46676C9401B5
DWORD dwExternalAttrib;
//##ModelId=46676C9401B6
bool bFolder;
};
//##ModelId=46676C9401F4
class CUnzipper
{
public:
//##ModelId=46676C940203
CUnzipper(LPCTSTR szFilePath = NULL);
//##ModelId=46676C940213
virtual ~CUnzipper();
// simple interface
//##ModelId=46676C940215
static bool Unzip(LPCTSTR szFileName, LPCTSTR szFolder = NULL, bool bIgnoreFilePath = FALSE);
// works with prior opened zip
//##ModelId=46676C940224
bool Unzip(bool bIgnoreFilePath = FALSE); // unzips to output folder or sub folder with zip name
//##ModelId=46676C940233
bool UnzipTo(LPCTSTR szFolder, bool bIgnoreFilePath = FALSE); // unzips to specified folder
// extended interface
//##ModelId=46676C940251
bool OpenZip(LPCTSTR szFilePath);
//##ModelId=46676C940261
bool CloseZip(); // for multiple reuse
//##ModelId=46676C940271
bool SetOutputFolder(LPCTSTR szFolder); // will try to create
// unzip by file index
//##ModelId=46676C940280
int GetFileCount();
//##ModelId=46676C940290
bool GetFileInfo(int nFile, UZ_FileInfo& info);
//##ModelId=46676C94029F
bool UnzipFile(int nFile, LPCTSTR szFolder = NULL, bool bIgnoreFilePath = FALSE);
// unzip current file
//##ModelId=46676C9402AF
bool GotoFirstFile(LPCTSTR szExt = NULL);
//##ModelId=46676C9402BF
bool GotoNextFile(LPCTSTR szExt = NULL);
//##ModelId=46676C9402CE
bool GetFileInfo(UZ_FileInfo& info);
//##ModelId=46676C9402D0
bool UnzipFile(LPCTSTR szFolder = NULL, bool bIgnoreFilePath = FALSE);
// helpers
//##ModelId=46676C9402DE
bool GotoFile(LPCTSTR szFileName, bool bIgnoreFilePath = TRUE);
//##ModelId=46676C9402E1
bool GotoFile(int nFile);
protected:
//##ModelId=46676C9402EE
void* m_uzFile;
//##ModelId=46676C9402EF
char m_szOutputFolder[MAX_PATH + 1];
protected:
//##ModelId=46676C9402FD
static bool CreateFolder(LPCTSTR szFolder);
//##ModelId=46676C94030F
static bool CreateFilePath(LPCTSTR szFilePath); // truncates from the last '\'
//##ModelId=46676C94031C
static bool SetFileModTime(LPCTSTR szFilePath, DWORD dwDosDate);
};
#endif // !defined(AFX_UNZIPPER_H__EBC42716_31C7_4659_8EF3_9BF8D4409709__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -