PowerTCP Zip Compression for .NET
Unzip(String,Boolean,Overwrite) Method
Example 




The destination directory for storing the decompressed file.
true if the directory path of the compressed item is preserved; false otherwise
Specifies whether to overwrite an existing file.
Decompresses the current item.
Syntax
<DescriptionAttribute("To decompresses the data this object represents. The destination is a directory. ")>
Public Overloads Sub Unzip( _
   ByVal destination As String, _
   ByVal preservePath As Boolean, _
   ByVal overwrite As Overwrite _
) 
Dim instance As ArchiveItem
Dim destination As String
Dim preservePath As Boolean
Dim overwrite As Overwrite
 
instance.Unzip(destination, preservePath, overwrite)
[Description("To decompresses the data this object represents. The destination is a directory. ")]
public void Unzip( 
   string destination,
   bool preservePath,
   Overwrite overwrite
)
[Description("To decompresses the data this object represents. The destination is a directory. ")]
public: void Unzip( 
   string* destination,
   bool preservePath,
   Overwrite overwrite
) 
[Description("To decompresses the data this object represents. The destination is a directory. ")]
public:
void Unzip( 
   String^ destination,
   bool preservePath,
   Overwrite overwrite
) 

Parameters

destination
The destination directory for storing the decompressed file.
preservePath
true if the directory path of the compressed item is preserved; false otherwise
overwrite
Specifies whether to overwrite an existing file.
Exceptions
ExceptionDescription
ZipExceptionA critical zip operation error occurred during this activity. Please see ZipException.Message for details.
Remarks
An unzip operation on an ArchiveItem will only decompress the item and not any other items in the collection.
Example
The following example demonstrates unzipping from an individual ArchiveItem.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

' Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

If (Archive1.Count > 1) Then

    ' Unzip the first item in the collection to a file, preserving its path
    Archive1(0).Unzip("c:\Test", True, Overwrite.Always)

    ' Unzip the second item in the collection to a memory stream
    Dim stream = New System.IO.MemoryStream()
    Archive1(1).Unzip(stream)
End If
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

// Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

if (archive1.Count > 1)
{
	// Unzip the first item in the collection to a file, preserving its path
	archive1[0].Unzip("c:\\Test", true, Overwrite.Always);

	// Unzip the second item in the collection to a memory stream
	System.IO.MemoryStream stream = new System.IO.MemoryStream();
	archive1[1].Unzip(stream);
}
See Also

Reference

ArchiveItem Class
ArchiveItem Members
Overload List


PowerTCP Zip for .NET Documentation Version 2.1.1
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic