Dart.PowerTCP.Zip Namespace > Archive Class > BeginQuickZip Method : BeginQuickZip(String,Stream,Object) Method |
<DescriptionAttribute("Begins an asynchronous Zip operation, zip a given source to a stream.")> Public Overloads Function BeginQuickZip( _ ByVal source As String, _ ByVal destination As Stream, _ ByVal state As Object _ ) As IAsyncResult
Dim instance As Archive Dim source As String Dim destination As Stream Dim state As Object Dim value As IAsyncResult value = instance.BeginQuickZip(source, destination, state)
[Description("Begins an asynchronous Zip operation, zip a given source to a stream.")] public IAsyncResult BeginQuickZip( string source, Stream destination, object state )
[Description("Begins an asynchronous Zip operation, zip a given source to a stream.")] public: IAsyncResult* BeginQuickZip( string* source, Stream* destination, Object* state )
[Description("Begins an asynchronous Zip operation, zip a given source to a stream.")] public: IAsyncResult^ BeginQuickZip( String^ source, Stream^ destination, Object^ state )
Exception | Description |
---|---|
System.InvalidOperationException | BeginXXX method used without providing an EndXXX event handler. |
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details. |
This method is a quick and easy way to use the Archive component to compress a given file or files to the specified destination Stream. It combines the two operations of Archive.Add and Archive.Zip.
The Archive.Password and Archive.Encryption properties are used for data encryption during the BeginQuickZip operation. The Archive.PreservePath property determines whether to preserve paths for each file item. The Archive.IncludeSubs property determines whether to include the subdirectories. The Archive.ExcludePattern property determines the files to exclude.
Note that data is written to the Stream at the current position and will not be reset to 0.
If an error occurs for an individual item during this operation, the Archive.Exception Event will be raised.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip" ' at the top of your class. ' Preserve the path structure of the files Archive1.PreservePath = True ' Include any subdirectories Archive1.IncludeSubs = True ' Exclude any text files Archive1.ExcludePattern = "*.txt" ' Set to use encryption Archive1.DefaultEncryption = Encryption.Standard ' Specify the password Archive1.Password = "testme" ' Perform the asynchronous compression operation Archive1.BeginQuickZip("c:\Test\*.txt", "c:\test.zip", Nothing) Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip Try If e.Exception Is Nothing Then MessageBox.Show("Zip Complete!") Else MessageBox.Show(e.Exception.Message) End If Catch End Try End Sub
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;" // at the top of your class. // Preserve the path structure of the files archive1.PreservePath = true; // Include any subdirectories archive1.IncludeSubs = true; // Exclude any text files archive1.ExcludePattern = "*.txt"; // Set to use encryption archive1.DefaultEncryption = Encryption.Standard; // Specify the password archive1.Password = "testme"; // Perform the asynchronous compression operation archive1.BeginQuickZip("c:\\Test\\*.txt", "c:\\test.zip", null); private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e) { try { if (e.Exception == null) MessageBox.Show("Zip Complete!"); else MessageBox.Show(e.Exception.Message); } catch {} }