A self-extracting zip file is a zip file that has the necessary information in its prefix (header) to unzip the files it contains without the need for third party applications such as WinZip ™ or even Xceed Zip for .NET. Therefore, converting a regular zip file only requires that the self-extractor binary be written in its prefix.
Basic concepts - Converting a zip file to a self-extracting zip file
To convert a zip file to a self-extracting zip file, the following steps must be taken :
-
Retrieve a reference to a new or existing zip file using the ZipArchive class.
-
Change the extension of the zip file to .EXE using the ZipArchive's Name property.
-
Create and configure a XceedSfxPrefix object. The XceedSfxPrefix object contains all the information required to allow the file to self-extract.
-
Assign the XceedSfxPrefix to the ZipArchive's SfxPrefix property.
Demonstration
The following example demonstrates how to convert a regular zip file to a self-extracting zip file.
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
using Xceed.Zip; |
Basic concepts - Converting a self-extracting zip file to a zip file
To convert a self-extracting zip file to a regular zip file, the following steps must be taken :
-
Retrieve a reference to a new or existing zip file using the ZipArchive class.
-
Change the extension of the zip file to .ZIP.
-
Set the ZipArchive's SfxPrefix property to null (Nothing in Visual Basic).
Demonstration
The following example demonstrates how to convert a self-extracting zip file to a regular zip file.
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
using Xceed.Zip; |
Things you should consider
The main questions you should ask yourself when copying items to a zip file are:
-
Do you want to display the status of the operation? See the Events topic.
-
Do you want to change the location of the temporary folder. Set the ZipArchive's TempFolder or DefaultTempFolder property.
-
Do you only want to do basic zip file operations? Use the QuickZip class.