C# Class ICSharpCode.SharpZipLib.Samples.SZ.SharpZipArchiver

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

Public Methods

Method Description
CookZipEntryName ( string name, string stripPrefix, bool relativePath ) : string

'Cook' a name making it acceptable as a zip entry name.

Main ( string args ) : void

Entry point for program, creates archiver and runs it

Private Methods

Method Description
Add ( ArrayList fileSpecs ) : void
AddFile ( string fileName ) : void

Add file to archive

AddFileSeekableOutput ( string file, string entryPath ) : void

Add a file were the output is seekable

AddFolder ( string folderName ) : void

Add an entry for a folder or directory

CompressFolder ( string basePath, bool recursiveSearch, string searchPattern ) : int

Compress contents of folder

CookZipEntryName ( string name ) : string

Make string into something acceptable as an entry name

Create ( ArrayList fileSpecifications ) : void

Create archives based on specifications passed and internal state

DecompressFile ( 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 fileSpecifications ) : void

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

ExtractDirectory ( ZipInputStream inputStream, ZipEntry theEntry, string targetDir ) : void
ExtractFile ( ZipInputStream inputStream, ZipEntry theEntry, string targetDir ) : bool
GetBuffer ( ) : byte[]
GetCompressionRatio ( long packedSize, long unpackedSize ) : int

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

InterpretExternalAttributes ( int operatingSystem, int attributes ) : string

Interpret attributes based on the operating system they are from.

IsNumeric ( string rhs ) : bool

Determine if string is numeric [0-9]+

List ( ArrayList fileSpecifications ) : void

Execute List operation Currently only Zip files are supported

ListZip ( string fileName ) : void

List zip file contents using stream

ListZipViaZipFile ( string fileName ) : void

List zip file contents using ZipFile class

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 indicated with an '=' as in -demo=argument, sometimes the '=' can be omitted as well secretly. Grouping of single character options is supported. The actual arguments and their handling is however a grab bag of ad-hoc things and its a bit messy. Could be a bit more rigorous about how things are done. Up side is almost anything is/can be allowed

ShowEnvironment ( ) : void

Show encoding/locale information

ShowHelp ( ) : void

Show help on possible options and arguments

ShowVersion ( ) : void

Display version information

Test ( ArrayList fileSpecs ) : void

Method Details

CookZipEntryName() public static method

'Cook' a name making it acceptable as a zip entry name.
public static CookZipEntryName ( string name, string stripPrefix, bool relativePath ) : string
name string name to cook
stripPrefix string String to remove from front of name if present
relativePath bool Make names relative if true or absolute if false
return string

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