Project Description

ZipFileEx add feature that support async/await and IProgress<T> to ZipFile/ZipArchive Classes.

InstallGuide

Nuget
or
Add Reference ZipFileEx.dll
or
include ZipFileEx.cs and Add Reference "System","System.Core","System.IO.Compression","System.IO.Compression.FileSystem".

Example

CreateFromDirectoryAsync

var progress = new ConsoleProgress<FileSystemProgressInfo>();

int i = 0;
progress.ProgressChanged += (sender, e) =>
{
    i++;
    Console.WriteLine("Added : " + e.FileSystemInfo.Name + string.Format(" ({0}/{1}).", i, e.All.Count));
};

await ZipFileEx.CreateFromDirectoryAsync(inputDirectory, outputFile, CompressionLevel.Optimal, false, Encoding.Default, progress);

ExtractToDirectoryAsync

var progress = new ConsoleProgress<ZipArchiveEntryProgressInfo>();

int i = 0;
progress.ProgressChanged += (sender, e) =>
{
    i++;
    Console.WriteLine("Expanded : " + e.ZipArchiveEntry.Name + string.Format(" ({0}/{1}).", i, e.All.Count));
};

await ZipFileEx.ExtractToDirectoryAsync(inputFile, outputDirectory, Encoding.Default, progress);

Members

ZipFileEx class

  • public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName)
  • public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName, CompressionLevel compressionLevel, bool includeBaseDirectory)
  • public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName, CompressionLevel compressionLevel, bool includeBaseDirectory, Encoding entryNameEncoding)
  • public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName, IProgress<FileSystemProgressInfo> progress)
  • public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName,CompressionLevel compressionLevel, bool includeBaseDirectory, IProgress<FileSystemProgressInfo> progress)
  • public static async Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationArchiveFileName,CompressionLevel compressionLevel, bool includeBaseDirectory, Encoding entryNameEncoding, IProgress<FileSystemProgressInfo> progress)
  • public static async Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName)
  • public static async Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, Encoding entryNameEncoding)
  • public static async Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, IProgress<ZipArchiveEntryProgressInfo> progress)
  • public static async Task ExtractToDirectoryAsync(string sourceArchiveFileName, string destinationDirectoryName, Encoding entryNameEncoding, IProgress<ZipArchiveEntryProgressInfo> progress)

ZipArchiveExtension(in ZipFileEx Class)

  • public static async Task ExtractToDirectoryAsync(this ZipArchive zip, string destinationDirectoryName)
  • public static async Task ExtractToDirectoryAsync(this ZipArchive zip, string destinationDirectoryName, IProgress<ZipArchiveEntryProgressInfo> progress)


Last edited Aug 22, 2012 at 5:29 AM by ugaya40, version 5