PowerTCP Zip Compression for .NET
PreservePath Property (Archive)
Example 




Gets or sets a value which determines if file paths are preserved when compressing or decompressing.
Syntax
<CategoryAttribute("Archive")>
<DefaultValueAttribute()>
<DescriptionAttribute("Specifies whether to preserve paths during zipping and unzipping.")>
Public Property PreservePath As Boolean
Dim instance As Archive
Dim value As Boolean
 
instance.PreservePath = value
 
value = instance.PreservePath
[Category("Archive")]
[DefaultValue()]
[Description("Specifies whether to preserve paths during zipping and unzipping.")]
public bool PreservePath {get; set;}
[Category("Archive")]
[DefaultValue()]
[Description("Specifies whether to preserve paths during zipping and unzipping.")]
public: __property bool get_PreservePath();
public: __property void set_PreservePath( 
   bool value
);
[Category("Archive")]
[DefaultValue()]
[Description("Specifies whether to preserve paths during zipping and unzipping.")]
public:
property bool PreservePath {
   bool get();
   void set (    bool value);
}

Property Value

true to preserve paths; false otherwise. The default value is false.
Remarks

When zipping, if this property is true, the path information will be stored in the resultant zip archive.

When unzipping, if this property is set to true, path information is used to create the directory structure under the specified destination directory. If the given zip archive does not contain the path information for the file items, this property has no effect for unzipping.

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