Dart.PowerTCP.Zip Namespace > Archive Class > BeginQuickZip Method : BeginQuickZip(String,String,Object) Method |
<DescriptionAttribute("Begins an asynchronous Zip operation, zip a given source to a file.")> Public Overloads Function BeginQuickZip( _ ByVal source As String, _ ByVal destination As String, _ ByVal state As Object _ ) As IAsyncResult
Dim instance As Archive Dim source As String Dim destination As String 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 file.")] public IAsyncResult BeginQuickZip( string source, string destination, object state )
[Description("Begins an asynchronous Zip operation, zip a given source to a file.")] public: IAsyncResult* BeginQuickZip( string* source, string* destination, Object* state )
[Description("Begins an asynchronous Zip operation, zip a given source to a file.")] public: IAsyncResult^ BeginQuickZip( String^ source, String^ 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 a specified destination file. 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.
During a zip operation, the source files are never altered in any manner unless the destination file has the same name as the source file. In that case, the file loaded with Open will be updated to contain the results of the zip operation. To prevent any unanticipated damage, the zip operation updates the destination only after a zip operation completes successfully.
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 {} }