Provides properties and methods for presenting a zipped file.
System.Object
EACompression.ZipFile
[Visual Basic] Public Class ZipFile
[C#] public class ZipFile
[C++] public __gc class ZipFile
[JScript] public class ZipFile
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. All instance members are not guaranteed to be thread safe.
Internal Constructors
ZipFile Constructor | Initializes a new instance of the ZipFile class. You can not use this constructor in your code directly. |
Public Properties
Attributes | Gets the file attributes. |
CompressedSize | Gets the file compressed size. |
CreationTime | Gets the file creation time. |
Encrypted | Gets whether the file is encrypted by password. |
FullName | Gets the file full name. |
IsDirectory | Gets whether the file is a directory. |
LastAccessTime | Gets the file last access time. |
LastWriteTime | Gets the file last write time. |
Length | Gets the file actual size. |
Name | Gets the file name. |
Example
[Visual Basic, C#, C++] The following example demonstrates how to compress/decompress file with EACompression Zip Component. This sample doesn't demonstrates the events, please refer to Samples section to get the full samples of EACompression.
[Visual Basic] Imports EACompression Sub Unzip() Try Dim oZip As New ZipArchive("TryIt") oZip.Load("c:\test.zip") Dim zs() As ZipFile = oZip.Files Dim count As Integer = zs.Length For i As Integer = 0 To count - 1 Dim z As ZipFile = zs(i) Console.WriteLine("Name: {0}", z.Name) Console.WriteLine("FullName: {0}", z.FullName) Console.WriteLine("Size: {0}", z.Length) Console.WriteLine("Compressed Size:{0}", z.CompressedSize) Console.WriteLine("Encrypted: {0}", z.Encrypted) Console.WriteLine("Is Directory: {0}", z.IsDirectory) Console.WriteLine("Creation Time: {0}", z.CreationTime) Console.WriteLine("Last Write Time: {0}", z.LastWriteTime) Console.WriteLine("Last Access Time: {0}", z.LastAccessTime) Console.WriteLine("Attributes: {0}", z.Attributes) Next Catch ep As Exception Console.Write(ep.Message) End Try End Sub [C#] using System; using System.Collections; using EACompression; void Unzip( ) { try { ZipArchive oZip = new ZipArchive( "TryIt" ); oZip.Load( "c:\\test.zip" ); ZipFile [] zs = oZip.Files; int count = zs.Length; for( int i = 0; i < count; i++ ) { ZipFile z = zs[i]; Console.WriteLine( "Name: {0}", z.Name ); Console.WriteLine( "FullName: {0}", z.FullName ); Console.WriteLine( "Size: {0}", z.Length ); Console.WriteLine( "Compressed Size:{0}", z.CompressedSize ); Console.WriteLine( "Encrypted: {0}", z.Encrypted ); Console.WriteLine( "Is Directory: {0}", z.IsDirectory ); Console.WriteLine( "Creation Time: {0}", z.CreationTime ); Console.WriteLine( "Last Write Time: {0}", z.LastWriteTime ); Console.WriteLine( "Last Access Time: {0}", z.LastAccessTime ); Console.WriteLine( "Attributes: {0}", z.Attributes ); } } catch( Exception ep ) { Console.Write( ep.Message ); } } [C++] using namespace System; using namespace System::Collections; using namespace EACompression; void Unzip( ) { try { ZipArchive *oZip = new ZipArchive( S"TryIt" ); oZip->Load( S"c:\\test.zip" ); ZipFile *zs[] = oZip->Files; int count = zs->Length; for( int i = 0; i < count; i++ ) { ZipFile *z = zs[i]; Console::WriteLine( S"Name: {0}", z->Name); Console::WriteLine( S"FullName: {0}", z->FullName ); Console::WriteLine( S"Size: {0}", __box(z->Length)); Console::WriteLine( S"Compressed Size:{0}", __box(z->CompressedSize)); Console::WriteLine( S"Encrypted: {0}", __box(z->Encrypted)); Console::WriteLine( S"Is Directory: {0}", __box(z->IsDirectory)); Console::WriteLine( S"Creation Time: {0}", __box(z->CreationTime)); Console::WriteLine( S"Last Write Time: {0}", __box(z->LastWriteTime)); Console::WriteLine( S"Last Access Time: {0}", __box(z->LastAccessTime)); Console::WriteLine( S"Attributes: {0}", __box(z->Attributes)); } } catch( Exception *ep ) { Console::Write( ep->Message ); } }