PowerTCP Zip Compression for .NET
CompressionLevel Property
Example 




Gets or sets the compression level for data compression.
Syntax
<DefaultValueAttribute()>
<CategoryAttribute("Archive")>
<DescriptionAttribute("Choose low, medium, or high compression.")>
Public Property CompressionLevel As CompressionLevel
Dim instance As Archive
Dim value As CompressionLevel
 
instance.CompressionLevel = value
 
value = instance.CompressionLevel
[DefaultValue()]
[Category("Archive")]
[Description("Choose low, medium, or high compression.")]
public CompressionLevel CompressionLevel {get; set;}
[DefaultValue()]
[Category("Archive")]
[Description("Choose low, medium, or high compression.")]
public: __property CompressionLevel get_CompressionLevel();
public: __property void set_CompressionLevel( 
   CompressionLevel value
);
[DefaultValue()]
[Category("Archive")]
[Description("Choose low, medium, or high compression.")]
public:
property CompressionLevel CompressionLevel {
   CompressionLevel get();
   void set (    CompressionLevel value);
}

Property Value

A CompressionLevel value specifying the compression level for data compression. The default value is CompressionLevel.Medium
Remarks

Note that the higher the compression level, the slower the process. An application should choose an appropriate value according to its needs.

If no compression is desired, set Archive.DefaultCompressionMethod or ArchiveItem.CompressionMethod to CompressionMethod.Store.

Example
The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.
' 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
	
' Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

' Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

' Exclude any text files
Archive1.ExcludePattern = "*.txt"

' Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

' Specify the password
Archive1.Password = "testme"

' Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")
// 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;
			
// Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;
			
// Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;
			
// Exclude any text files
archive1.ExcludePattern = "*.txt";
			
// Set to use encryption
archive1.DefaultEncryption = Encryption.Standard;

// Specify the password
archive1.Password = "testme";
			
// Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");
See Also

Reference

Archive Class
Archive Members


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