ckzip.h
来自「DES加密解密算法,西望大家共享.参考学习」· C头文件 代码 · 共 427 行 · 第 1/2 页
H
427 行
// CkZip.h: interface for the CkZip class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _CKZIP_H
#define _CKZIP_H
#pragma once
#include "CkString.h"
class CkByteData;
class CkZipProgress;
class CkZipEntry;
class CkStringArray;
#include "CkObject.h"
/*
IMPORTANT: Objects returned by methods as non-const pointers must be deleted
by the calling application.
*/
// CLASS: CkZip
class CkZip : public CkObject
{
public:
CkZip();
virtual ~CkZip();
bool OpenFromMemory(const char *zipFileInMemory, unsigned long dataLen);
bool AddEmbeddedFromMemory(const char *exeFilename, const char *resourceName, const char *data, unsigned int dataLen);
CkZipEntry *AppendData(const char *fileName, const char *data, unsigned long dataLen);
// BEGIN PUBLIC INTERFACE
bool get_Utf8(void) const;
void put_Utf8(bool b);
bool ExtractMatching(const char *dirPath, const char *pattern, CkZipProgress *progress);
bool WriteZip(CkZipProgress *progress);
bool WriteZipAndClose(CkZipProgress *progress);
bool Extract(const char *dirPath, CkZipProgress *progress);
bool ExtractNewer(const char *dirPath, CkZipProgress *progress);
bool AppendFiles(const char *filePattern, bool recurse, CkZipProgress *progress);
bool AppendFilesEx(const char *filePattern, bool recurse, bool saveExtraPath, bool archiveOnly, bool includeHidden, bool includeSystem, CkZipProgress *progress);
bool AppendMultiple(const CkStringArray *fileSpecs, bool recurse, CkZipProgress *progress);
bool AppendMultiple(const CkStringArray &fileSpecs, bool recurse, CkZipProgress *progress)
{
return this->AppendMultiple(&fileSpecs,recurse,progress);
}
bool WriteExe(const char *filename, CkZipProgress *progress);
int Unzip(const char *dirPath, CkZipProgress *progress);
int UnzipNewer(const char *dirPath, CkZipProgress *progress);
int UnzipInto(const char *dirPath, CkZipProgress *progress);
int UnzipMatching(const char *dirPath, const char *pattern, bool verbose, CkZipProgress *progress);
int UnzipMatchingInto(const char *dirPath, const char *pattern, bool verbose, CkZipProgress *progress);
bool WriteExe2(const char *exeFilename, const char *outExeFilename, bool bAesEncrypt, int keyLength, const char *password, CkZipProgress *progress);
// If true, use standard WinZip password-protection.
bool get_PasswordProtect(void);
void put_PasswordProtect(bool newVal);
// If != 0, use encryption, which is different from WinZip password
// protection and requires that an application using Chilkat Zip must
// be used to decrypt the Zip.
// 0 = none, 1 = blowfish, 2 = twofish, 3 = rijndael (AES)
long get_Encryption(void);
void put_Encryption(long newVal);
// This property defaults to the OEM code page of the computer.
// Set it to read Zips created on computers in other languages,
// or to create a Zip targeted for another language.
long get_OemCodePage(void);
void put_OemCodePage(long newVal);
// Set to 128, 192, or 256-bit AES encryption.
long get_EncryptKeyLength(void);
void put_EncryptKeyLength(long newVal);
// The library version, such as "9.9.0"
void get_Version(CkString &pVal);
// The temporary directory to use when unzipping files.
void get_TempDir(CkString &pVal);
void put_TempDir(const char *newVal);
// When files are appended, they are appended from this directory.
void get_AppendFromDir(CkString &pVal);
void put_AppendFromDir(const char *newVal);
// A proxy to use with the OpenFromWeb method.
void get_Proxy(CkString &pVal);
void put_Proxy(const char *newVal);
// (For creating self-extracting EXEs)
// This is the name of a file within the Zip that is designated to be automatically run after
// a self-extracting EXE unzips. If set, then WriteExe will create a self-extracting EXE that
// automatically runs this EXE after unzipping. The typical use for this
// is to set AutoRun = "Setup.exe" for installation EXEs
void get_AutoRun(CkString &pVal);
void put_AutoRun(const char *newVal);
// (For creating self-extracting EXEs)
// If True then the EXE created by WriteExe will automatically unzip to a temp directory
// when double-clicked. This option is only valid when an AutoRun filename is also set.
// If set to False, the self-extracting EXE will prompt for an unzip directory.
bool get_AutoTemp(void);
void put_AutoTemp(bool newVal);
bool get_ExeNoInterface(void);
void put_ExeNoInterface(bool newVal);
void get_AutoRunParams(CkString &pVal);
void put_AutoRunParams(const char *newVal);
void get_ExeSourceUrl(CkString &pVal);
void put_ExeSourceUrl(const char *newVal);
void get_ExeTitle(CkString &pVal);
void put_ExeTitle(const char *newVal);
void get_ExeUnzipCaption(CkString &pVal);
void put_ExeUnzipCaption(const char *newVal);
void get_ExeUnzipDir(CkString &pVal);
void put_ExeUnzipDir(const char *newVal);
void get_ExeDefaultDir(CkString &pVal);
void put_ExeDefaultDir(const char *newVal);
void get_ExeIconFile(CkString &pVal);
void put_ExeIconFile(const char *newVal);
void put_ExeFinishNotifier(bool newVal);
bool get_ExeFinishNotifier(void);
void put_ExeSilentProgress(bool newVal);
bool get_ExeSilentProgress(void);
//void put_ExeDeleteAfterSetup(bool newVal);
//bool get_ExeDeleteAfterSetup(void);
bool get_ClearArchiveAttribute(void);
void put_ClearArchiveAttribute(bool newVal);
// Number of entries within the Zip.
long get_NumEntries(void);
// The Zip filename.
void get_FileName(CkString &pVal);
void put_FileName(const char *newVal);
// The comment stored within the Zip file header.
void get_Comment(CkString &pVal);
void put_Comment(const char *newVal);
// Add this prefix to all filenames when zipping.
void get_PathPrefix(CkString &pVal);
void put_PathPrefix(const char *newVal);
// Discard filename paths when zipping.
bool get_DiscardPaths(void);
void put_DiscardPaths(bool newVal);
// Returns the first entry in the Zip.
CkZipEntry *FirstEntry(void);
// Call this any number of times before calling AppendFiles
// to exclude entire directory subtrees.
void ExcludeDir(const char *dirName);
// True if this Zip is standard WinZip password-protected.
bool IsPasswordProtected(const char *zipFilename);
// If an image of a Zip file is already in memory, it can be opened using this method.
bool OpenFromMemory(const unsigned char *zipFileInMemory, unsigned long dataLen);
// Opens a ZIP embedded within an EXE. This only works for EXEs created by Chilkat Zip.
bool OpenEmbedded(const char *exeFilename, const char *resourceName);
// Opens the ZIP embedded in the caller's EXE. This only works for EXEs created by Chilkat Zip.
bool OpenMyEmbedded(const char *resourceName);
// Embeds a ZIP file into an EXE. The ZIP is stored as a named resource within the EXE.
// You may store more than one ZIP within a single EXE, so long as the resource names are unique.
bool AddEmbedded(const char *exeFilename, const char *resourceName, const char *zipFilename);
// Embed data from memory into an EXE.
bool AddEmbeddedFromMemory(const char *exeFilename, const char *resourceName, const unsigned char *data, unsigned int dataLen);
// Replaces a ZIP embedded in an EXE with another one.
bool ReplaceEmbedded(const char *exeFilename, const char *resourceName, const char *zipFilename);
// Removes an embedded ZIP from an EXE.
bool RemoveEmbedded(const char *exeFilename, const char *resourceName);
// Sets the password used for either WinZip password-protection or AES encryption.
void SetPassword(const char *password);
// You can specify wildcarded patterns of files to exclude from zipping, such as "*.log",
// which would prevent any file ending in ".log" from being added to a zip. Any number of
// exclusions can be added, and the exclusions pertain to any of the Append* methods.
void SetExclusions(const CkStringArray *excludePatterns);
void SetExclusions(const CkStringArray &excludePatterns) { this->SetExclusions(&excludePatterns); }
// Returns the exclusions previously set by SetExclusions.
CkStringArray *GetExclusions(void);
// Returns the first Zip entry whose filename matches the FilePattern.
// The pattern can contain any number of "*" or "?" wildcards. "*" means 0 or more of any
// character, "?" means any single character.
CkZipEntry *FirstMatchingEntry(const char *pattern);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?