PowerTCP Zip Compression for .NET
Name Property
Example 




Gets or sets the name of the item.
Syntax
<DescriptionAttribute("The name of the item. When the item is a file, it is the file name. When the item is a stream, it will be based on the default naming convention, that is, Streamxx, where xx is the index of the item in its parent Archive collection.")>
<CategoryAttribute("ArchiveItem")>
<DefaultValueAttribute()>
Public Property Name As String
Dim instance As ArchiveItem
Dim value As String
 
instance.Name = value
 
value = instance.Name
[Description("The name of the item. When the item is a file, it is the file name. When the item is a stream, it will be based on the default naming convention, that is, Streamxx, where xx is the index of the item in its parent Archive collection.")]
[Category("ArchiveItem")]
[DefaultValue()]
public string Name {get; set;}
[Description("The name of the item. When the item is a file, it is the file name. When the item is a stream, it will be based on the default naming convention, that is, Streamxx, where xx is the index of the item in its parent Archive collection.")]
[Category("ArchiveItem")]
[DefaultValue()]
public: __property string* get_Name();
public: __property void set_Name( 
   string* value
);
[Description("The name of the item. When the item is a file, it is the file name. When the item is a stream, it will be based on the default naming convention, that is, Streamxx, where xx is the index of the item in its parent Archive collection.")]
[Category("ArchiveItem")]
[DefaultValue()]
public:
property String^ Name {
   String^ get();
   void set (    String^ value);
}

Property Value

A string representing the name of the item.
Remarks

When creating an archive, this property will reflect the actual name of the file on the disk. If the item is a non-file (for example, a MemoryStream) this property will return "Streamn", where n is the index of the item in the archive. In this case, it is often useful to set this property to assign a new name to the item.

Changing this property will have no impact on the source, just the destination.

Example
The following example demonstrates using the Progress event.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        ' Set the progress bar and status when fires
        ' prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                ' Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                ' Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
		{
			try
			{
				// Set the progress bar and status when fires
				// prgItem is the progress bar for an individual item and prgTotal is for all the items.
				switch (e.Status)
				{
					case Status.Unzipping:
						// Show item progress
						prgItem.Maximum = (int)e.Item.Size;
						prgItem.Value = (int)e.ProcessedItemBytes;

						// Show total progress
						prgTotal.Maximum = (int)e.TotalBytes;
						prgTotal.Value = (int)e.ProcessedTotalBytes;

						Debug.WriteLine("Unzipping " + e.Item.Name);
						break;
					case Status.EndUnzip:
						prgTotal.Value = prgTotal.Maximum;
						break;
				}
			}
			catch {}
		}
See Also

Reference

ArchiveItem Class
ArchiveItem Members


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