C# Class EnterpriseWebLibrary.IO.ZipOps

Contains methods that zip and unzip data.
Afficher le fichier Open project: enduracode/enterprise-web-library

Méthodes publiques

Méthode Description
UnZipByteArrayAsFolder ( byte sourceData, string destinationFolderPath ) : void

Unzips the specified ZIP byte array into a new folder with the specified path. If a folder already exists at the path, it is deleted.

UnZipFileAsFolder ( string sourceFilePath, string destinationFolderPath ) : void

Unzips the specified ZIP file into a new folder with the specified path. If a folder already exists at the path, it is deleted.

UnZipStreamAsFileObjects ( Stream source ) : IEnumerable

This method completely ignores directory structure of the zip file in the source stream. The result is a flattened list of files. But, the file names do contain the relative path information, so they can be used to re-create the directory structure.

UnZipStreamAsFolder ( Stream sourceStream, string destinationFolderPath ) : void

Unzips the specified ZIP stream into a new folder with the specified path. If a folder already exists at the path, it is deleted.

UnZipStreamIntoFolder ( Stream sourceStream, string destinationFolderPath ) : void

Unzips the specified ZIP stream to the new or existing folder. If the folder already exists, archive items will be added to the existing folder structure. Files will be overwritten when there is an existing file with the same name as an archive file.

ZipFileObjectsAsStream ( IEnumerable files, Stream destination ) : void

Creates a zip file into the destination stream, given the sources. Tuple file names will be cleaned. File names must include extension.

ZipFileStreamsAsStream ( Stream>.IEnumerable fileNameAndSources, Stream destination ) : void

Creates a zip file into the destination stream, given the sources. Tuple file names will be cleaned. File names must include extension.

ZipFilesAsStream ( IEnumerable filePaths, Stream outputStream ) : void

Zips all specified files into a stream. All files are put in the root of the zip file. The caller is responsible for disposing the stream.

ZipFolderAsByteArray ( string sourceFolderPath ) : byte[]

Zips all files and folders (recursively) in the specified folder into a ZIP byte array that represents a zip file.

ZipFolderAsFile ( string sourceFolderPath, string destinationFilePath ) : void

Zips all files in the specified folder into a new ZIP file with the specified path. If a file already exists at the path, it is overwritten.

ZipFolderAsStream ( string sourceFolderPath, Stream outputStream ) : void

Zips all files and folders (recursively) in the specified folder into a memory stream. The caller is responsible for disposing the stream.

Private Methods

Méthode Description
Test ( ) : void
createZipOutputStream ( Stream s ) : ZipOutputStream
writeZipEntry ( ZipEntry zipEntry, Stream sourceStream, ZipOutputStream zipOutputStream ) : void

Method Details

UnZipByteArrayAsFolder() public static méthode

Unzips the specified ZIP byte array into a new folder with the specified path. If a folder already exists at the path, it is deleted.
public static UnZipByteArrayAsFolder ( byte sourceData, string destinationFolderPath ) : void
sourceData byte
destinationFolderPath string
Résultat void

UnZipFileAsFolder() public static méthode

Unzips the specified ZIP file into a new folder with the specified path. If a folder already exists at the path, it is deleted.
public static UnZipFileAsFolder ( string sourceFilePath, string destinationFolderPath ) : void
sourceFilePath string
destinationFolderPath string
Résultat void

UnZipStreamAsFileObjects() public static méthode

This method completely ignores directory structure of the zip file in the source stream. The result is a flattened list of files. But, the file names do contain the relative path information, so they can be used to re-create the directory structure.
public static UnZipStreamAsFileObjects ( Stream source ) : IEnumerable
source Stream
Résultat IEnumerable

UnZipStreamAsFolder() public static méthode

Unzips the specified ZIP stream into a new folder with the specified path. If a folder already exists at the path, it is deleted.
public static UnZipStreamAsFolder ( Stream sourceStream, string destinationFolderPath ) : void
sourceStream Stream
destinationFolderPath string
Résultat void

UnZipStreamIntoFolder() public static méthode

Unzips the specified ZIP stream to the new or existing folder. If the folder already exists, archive items will be added to the existing folder structure. Files will be overwritten when there is an existing file with the same name as an archive file.
public static UnZipStreamIntoFolder ( Stream sourceStream, string destinationFolderPath ) : void
sourceStream Stream
destinationFolderPath string
Résultat void

ZipFileObjectsAsStream() public static méthode

Creates a zip file into the destination stream, given the sources. Tuple file names will be cleaned. File names must include extension.
public static ZipFileObjectsAsStream ( IEnumerable files, Stream destination ) : void
files IEnumerable
destination Stream
Résultat void

ZipFileStreamsAsStream() public static méthode

Creates a zip file into the destination stream, given the sources. Tuple file names will be cleaned. File names must include extension.
public static ZipFileStreamsAsStream ( Stream>.IEnumerable fileNameAndSources, Stream destination ) : void
fileNameAndSources Stream>.IEnumerable
destination Stream
Résultat void

ZipFilesAsStream() public static méthode

Zips all specified files into a stream. All files are put in the root of the zip file. The caller is responsible for disposing the stream.
public static ZipFilesAsStream ( IEnumerable filePaths, Stream outputStream ) : void
filePaths IEnumerable
outputStream Stream
Résultat void

ZipFolderAsByteArray() public static méthode

Zips all files and folders (recursively) in the specified folder into a ZIP byte array that represents a zip file.
public static ZipFolderAsByteArray ( string sourceFolderPath ) : byte[]
sourceFolderPath string
Résultat byte[]

ZipFolderAsFile() public static méthode

Zips all files in the specified folder into a new ZIP file with the specified path. If a file already exists at the path, it is overwritten.
public static ZipFolderAsFile ( string sourceFolderPath, string destinationFilePath ) : void
sourceFolderPath string
destinationFilePath string
Résultat void

ZipFolderAsStream() public static méthode

Zips all files and folders (recursively) in the specified folder into a memory stream. The caller is responsible for disposing the stream.
public static ZipFolderAsStream ( string sourceFolderPath, Stream outputStream ) : void
sourceFolderPath string
outputStream Stream
Résultat void