Gets or sets the archive file format.
[Visual Basic] Public Property Format As CompressionFormat
[C#]
public CompressionFormat Format {get; set;}
[C++] public: __property CompressionFormat get_Format(); public: __property set_Format( CompressionFormat );
[JScript] public function get Format() :CompressionFormat; public function set Format( CompressionFormat );
Property Value
Remarks
If the file is UUEncoded file, creating uuencoded file and adding file to uuencoded file are not supported. You can only extract or remove file from uuencoded file. By default, ZipArchive always uses CompressionFormat.Zip.
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")
'if you load a uuencoded file
'oZip.Format = CompressionFormat.UUEncode
'oZip.Load("c:\test.uue" )
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" );
//if you load a uuencoded file
//oZip.Format = CompressionFormat.UUEncode;
//oZip.Load("c:\\test.uue" );
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" );
//if you load a uuencoded file
//oZip->Format = CompressionFormat::UUEncode;
//oZip->Load(S"c:\\test.uue" );
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 );
}
}