C# Класс EnterpriseWebLibrary.IO.ZipOps

Contains methods that zip and unzip data.
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Test ( ) : void
createZipOutputStream ( Stream s ) : ZipOutputStream
writeZipEntry ( ZipEntry zipEntry, Stream sourceStream, ZipOutputStream zipOutputStream ) : void

Описание методов

UnZipByteArrayAsFolder() публичный статический Метод

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
Результат void

UnZipFileAsFolder() публичный статический Метод

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
Результат void

UnZipStreamAsFileObjects() публичный статический Метод

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
Результат IEnumerable

UnZipStreamAsFolder() публичный статический Метод

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
Результат void

UnZipStreamIntoFolder() публичный статический Метод

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
Результат void

ZipFileObjectsAsStream() публичный статический Метод

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
Результат void

ZipFileStreamsAsStream() публичный статический Метод

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
Результат void

ZipFilesAsStream() публичный статический Метод

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
Результат void

ZipFolderAsByteArray() публичный статический Метод

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
Результат byte[]

ZipFolderAsFile() публичный статический Метод

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
Результат void

ZipFolderAsStream() публичный статический Метод

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
Результат void