C# Class ICSharpCode.SharpZipLib.Samples.CS.ZF.ZipFileArchiver

A command line archiver using the ZipFile class from the SharpZipLib compression library
Show file Open project: icsharpcode/SharpZipLib Class Usage Examples

Public Methods

Method Description
Main ( string args ) : void

Entry point for program, creates archiver and runs it

ZipFileArchiver ( ) : System

Initializes a new instance of the ZipFileArchiver class.

Private Methods

Method Description
Add ( ArrayList fileSpecs ) : void

Add files to an archive

Create ( ArrayList fileSpecs ) : void

Create archives based on specifications passed and internal state

DecompressArchive ( string fileName, string targetDir ) : bool

Decompress a file

Delete ( ArrayList fileSpecs ) : void

Delete entries from an archive

Execute ( string args ) : void

Parse command line arguments and 'execute' them.

Extract ( ArrayList fileSpecs ) : void

Extract archives based on user input Allows simple wildcards to specify multiple archives

ExtractFile ( Stream inputStream, ZipEntry theEntry, string targetDir ) : bool

Extract a file storing its contents.

GetBuffer ( ) : byte[]
GetCompressionRatio ( long packedSize, long unpackedSize ) : int

Calculate compression ratio as a percentage This wont allow for expansion (ratio > 100) as the resulting strings can get huge easily

InterpretExternalAttributes ( int operatingSystem, int attributes ) : string

Interpret attributes in conjunction with operatingSystem

IsNumeric ( string rhs ) : bool

Determine if string is numeric [0-9]+

List ( ArrayList fileSpecs ) : void

Execute List operation Currently only Zip files are supported

ListArchiveContents ( ZipFile zipFile, FileInfo fileInfo ) : void
ListArchiveContents ( string fileName ) : void

List zip file contents using ZipFile class

MakeExternalAttributes ( FileInfo info ) : int

Make external attributes suitable for a ZipEntry

ProcessDirectory ( object sender, DirectoryEventArgs args ) : void

Callback for adding a new directory.

Directories are only added if they are empty and the user has specified that empty directories are to be added.

ProcessFile ( object sender, ScanEventArgs args ) : void

Callback for adding a new file.

SetArgs ( string args ) : bool

Parse command line arguments. This is fairly flexible without using any custom classes. Arguments and options can appear in any order and are case insensitive. Arguments for options are signalled with an '=' as in -demo=argument, sometimes the '=' can be omitted as well secretly. Grouping of single character options is supported.

ShowEnvironment ( ) : void

Show encoding/locale information

ShowHelp ( ) : void

Show help on possible options and arguments

ShowVersion ( ) : void

Display version information

Test ( ArrayList fileSpecs ) : void

Test an archive to see if its valid.

TestResultHandler ( TestStatus status, string message ) : void

Handler for test result callbacks.

WildcardToRegex ( string wildcard ) : string

Convert a wildcard expression to a regular expression

Method Details

Main() public static method

Entry point for program, creates archiver and runs it
public static Main ( string args ) : void
args string /// Command line argument to process ///
return void

ZipFileArchiver() public method

Initializes a new instance of the ZipFileArchiver class.
public ZipFileArchiver ( ) : System
return System