PowerTCP Zip Compression for .NET
ArchiveItem Constructor(String)
Example 




The name of the file to be created as an ArchiveItem object.
Creates an individual item inside an Archive.
Syntax
<DescriptionAttribute("The ArchiveItem string constructor.")>
Public Function New( _
   ByVal fileName As String _
)
Dim fileName As String
 
Dim instance As New ArchiveItem(fileName)
[Description("The ArchiveItem string constructor.")]
public ArchiveItem( 
   string fileName
)
[Description("The ArchiveItem string constructor.")]
public: ArchiveItem( 
   string* fileName
)
[Description("The ArchiveItem string constructor.")]
public:
ArchiveItem( 
   String^ fileName
)

Parameters

fileName
The name of the file to be created as an ArchiveItem object.
Remarks

This class enables an application to access and manipulate the data of an individual file within an archive. It also provides support for data decompression at the file level.

To add the ArchiveItem to the Archive collection, use Archive.Add or Archive.Insert.

Changing any ArchiveItem property will not impact the source. Changes only have impact on the destination. For example, changing ArchiveItem.Name will not change the name of the original source file, but after a zip operation the file will be archived with the name specified in the ArchiveItem.Name property.

Example
The following example demonstrates several Add techniques and a zip operation.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

' Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

' Add a comment to this item
item.Comment = "This is file1.txt"

' Use encryption for just this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

' Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

' Add a wildcard collection of files
' In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
' Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

' zip the data
Archive1.Zip("c:\test.zip")
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

// Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

// Add a comment to this item
item.Comment = "This is file1.txt";

// Use encryption for just this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

// Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

// Add a wildcard collection of files
// In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
// Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

// Zip the data
archive1.Zip("c:\\test.zip");
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