ckzip.h

来自「DES加密解密算法,西望大家共享.参考学习」· C头文件 代码 · 共 427 行 · 第 1/2 页

H
427
字号
	// Returns an XML formatted listing of the contents of the Zip archive. An example is shown below: 
	/*
	<zip_contents>
		  <dir name="Images">
			  <file>flag.jpg</file> 
		  </dir>
		  <dir name="Sounds">
			  <file>SOUND45.WAV</file> 
			  <file>SOUND49.WAV</file> 
			  <file>SOUND49D.WAV</file> 
		  </dir>
		  <dir name="Source">
			  <dir name="Include">
				  <file>OLEACC.H</file> 
				  <file>OLEAUTO.H</file> 
				  <file>OLECTL.H</file> 
			  </dir>
			  <file>ATL.CPP</file> 
			  <file>REGOBJ.CPP</file> 
			  <file>STDAFX.CPP</file> 
		  </dir>
		  <dir name="Spreadsheets">
			  <file>SAMPLES.XLS</file> 
		  </dir>
		  <file>bullet.gif</file> 
		  <file>chilkatLicense.txt</file> 
		  <file>default.asp</file> 
		  <file>file.gif</file> 
		  <file>global.asa</file> 
		  <file>guestbk.asp</file> 
		  <file>il941.pdf</file> 
		  <file>myfiles.asp</file> 
		  <file>signbook.asp</file> 
		  <file>sub.inc</file> 
		  <file>theme.inc</file> 
		  <file>themes.inc</file> 
	</zip_contents>
	*/
	void GetDirectoryAsXML(CkString &xml);

	// Extract all the files that match the pattern. Subdirectories are automatically created as needed. 
	// The pattern can contain any number of "*" or "?" wildcards. "*" means 0 or more of any character, "?" means any single character.
	bool ExtractMatching(const char *dirPath, const char *pattern);

	// Retrieves a Zip entry by ID. Chilkat Zip automatically assigns a unique ID to each Zip 
	// entry in memory. The IDs are not persisted to disk. 
	CkZipEntry *GetEntryByID(long entryID);

	// Writes the Zip to disk using the FileName property for the name of the file.
	// A Zip file is never updated on disk until one of the Write methods is called.
	bool WriteZip(void);

	// Same as WriteZip, but the file is closed after writing.
	bool WriteZipAndClose(void);

	// Loads the contents of a Zip file into the Chilkat Zip object. 
	bool OpenZip(const char *zipFileName);

	// Opens a Zip from a URL.
	bool OpenFromWeb(const char *url);
	bool OpenFromWeb(const char *url, CkZipProgress *progress);

	// Clears the contents of the Zip object, and initializes the FileName property. 
	// This does not create a file on disk, it simply initializes the Zip object to a new and empty state.
	bool NewZip(const char *zipFileName);

	// Returns a Zip entry by filename.
	CkZipEntry *GetEntryByName(const char *entryName);

	// Returns the Nth Zip entry.  The first entry is at index 0.
	CkZipEntry *GetEntryByIndex(long index);

	// Unzip all the files into the specified directory. Subdirectories are automatically created 
	// as needed.
	bool Extract(const char *dirPath);

	// Extracts only the files that have more recent last-modified-times than the files on disk. 
	// This allows you to easily refresh only the files that have been updated.
	bool ExtractNewer(const char *dirPath);

	// Append all the files from within another Zip file into this one.
	bool AppendZip(const char *zipFileName);

	// Appends a single file, or a directory (not the files in the directory, but the
	// directory entry itself) to a Zip file.
	bool AppendOneFileOrDir(const char *fileOrDirName);
	bool AppendOneFileOrDir(const char *fileOrDirName, bool saveExtraPath);

	// Appends one or more files to the Zip object. The FilePattern can use the "*" or "?" 
	// wildcard characters. "*" means 0 or more of any character, and "?" means any single character. 
	// Set Recurse equal to true to recursively add all subdirectories, or false to only add files 
	// in the current directory.
	bool AppendFiles(const char *filePattern, bool recurse);

	// Same as AppendFiles, but extra parameters are to control whether or not the full pathname 
	// is included with the Zip entry, or whether files with the Archive, Hidden, or 
	// System attributes are included. true = yes, false = no.
	bool AppendFilesEx(const char *filePattern, bool recurse, bool saveExtraPath, bool archiveOnly, bool includeHidden, bool includeSystem);

	// Same as calling AppendFiles multiple times - once for each file pattern in the CkStringArray.
	bool AppendMultiple(const CkStringArray *fileSpecs, bool recurse);
	bool AppendMultiple(const CkStringArray &fileSpecs, bool recurse) { return this->AppendMultiple(&fileSpecs,recurse); }

	// Creates a new Zip entry and initializes it with uncompressed memory data. 
	// The CkZipEntry's FileName property is initialized to fileName. 
	CkZipEntry *AppendData(const char *fileName, const CkByteData &data);
	CkZipEntry *AppendData(const char *fileName, const unsigned char *data, unsigned long dataLen);
	CkZipEntry *AppendString(const char *fileName, const char *str);
	CkZipEntry *AppendString2(const char *fileName, const char *str, const char *charset);

	// Appends a new and empty entry to the Zip object.
	CkZipEntry *AppendNew(const char *fileName);
	CkZipEntry *AppendNewDir(const char *dirName);

	// Inserts a new and empty entry to the Zip object.
	CkZipEntry *InsertNew(const char *fileName, long beforeIndex);

	// Creates a new Zip entry and initializes it with already-compressed data. 
	// The CkZipEntry's FileName property is initialized to fileName.
	CkZipEntry *AppendCompressed(const char *fileName, const CkByteData &data);

	// Removes an entry from the Zip object. The procedure for removing a file from an existing Zip 
	// is to (1) open the Zip, (2) remove the entry by calling this method, 
	// and (3) writing the Zip.
	bool DeleteEntry(const CkZipEntry *entry);
	bool DeleteEntry(const CkZipEntry &entry) { return this->DeleteEntry(&entry); }

	// Creates a new Zip entry and initializes it with already-compressed data that is base-64 encoded. 
	// The CkZipEntry's FileName property is initialized to fileName. 
	CkZipEntry *AppendBase64(const char *fileName, const char *data);

	// Creates a new Zip entry and initializes it with already-compressed data that is Hex encoded. 
	// The CkZipEntry's FileName property is initialized to fileName. 
	CkZipEntry *AppendHex(const char *fileName, const char *data);

	// Creates a self-extracting EXE.
	bool WriteExe(const char *filename);

	// Creates a image of a Zip file in memory
	bool WriteToMemory(CkByteData &bData);

	// Closes the Zip and releases the Zip file if one was open for reading and/or writing.
	void CloseZip(void);

	// Must be called once at the beginning of a program.
	bool UnlockComponent(const char *regCode);
	bool IsUnlocked(void) const;

	// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
	bool SaveLastError(const char *filename);
        void LastErrorXml(CkString &str);
        void LastErrorHtml(CkString &str);
        void LastErrorText(CkString &str);


	// Returns -1 for failure, otherwise the return value is the number of files unzipped.
	// These are identical to the equivalent "Extract" methods, except they return the
	// number of files unzipped.

	int Unzip(const char *dirPath);
	int UnzipNewer(const char *dirPath);
	int UnzipInto(const char *dirPath);
	int UnzipMatching(const char *dirPath, const char *pattern, bool verbose);
	int UnzipMatchingInto(const char *dirPath, const char *pattern, bool verbose);

	// Set the compression level for all entries in the Zip.
	void SetCompressionLevel(int level);

	bool WriteExe2(const char *exeFilename, const char *outExeFilename, bool bAesEncrypt, int keyLength, const char *password);

	CkString m_resultString;
        const char *lastErrorText(void);
        const char *lastErrorXml(void);
        const char *lastErrorHtml(void);

	const char *version(void);
	const char *tempDir(void);
	const char *appendFromDir(void);
	const char *proxy(void);
	const char *autoRun(void);
	const char *autoRunParams(void);
	const char *exeTitle(void);
	const char *exeUnzipCaption(void);
	const char *exeUnzipDir(void);
	const char *exeDefaultDir(void);
	const char *exeIconFile(void);
	const char *fileName(void);
	const char *pathPrefix(void);
	const char *getDirectoryAsXML(void);


	// END PUBLIC INTERFACE



    // Everything below is for internal use only.
    private:
	void *m_impl;
	bool m_utf8;	// If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.

	// Don't allow assignment or copying these objects.
	CkZip(const CkZip &) { } 
	CkZip &operator=(const CkZip &) { return *this; }
	CkZip(void *impl) : m_impl(impl) { }

    public:
	void *getImpl(void) const { return m_impl; } 


};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?