Example #1
0
    public static void UnzipAsync(string fileName,
                                  string targetDir,
                                  ICSharpCode.SharpZipLib.Core.TotalProgressHandler hTotalProgress = null,
                                  ICSharpCode.SharpZipLib.Core.TotalFinishHandler hTotalFinish     = null)
    {
        ICSharpCode.SharpZipLib.Zip.FastZipEvents2 events = new ICSharpCode.SharpZipLib.Zip.FastZipEvents2();
        events.TotalProgress    = hTotalProgress;
        events.TotalFinish      = hTotalFinish;
        events.Progress         = ProgressHandler;
        events.ProgressInterval = TimeSpan.FromSeconds(0.5);

        mZip2      = new ICSharpCode.SharpZipLib.Zip.FastZip2(events);
        mZipFile   = fileName;
        mTargetDir = targetDir;

        Thread th = new Thread(StartUnzipFile);

        th.IsBackground = true;
        th.Start();
    }
Example #2
0
    public UnzipUtil(Stream zipStream,
                     string targetDir,
                     HandleExtractProgress hTotalProgress = null,
                     HandleExtractFinish hTotalFinish     = null)
    {
        mTotalProgress = hTotalProgress;
        mResultHandler = hTotalFinish;

        ICSharpCode.SharpZipLib.Zip.FastZipEvents2 events = new ICSharpCode.SharpZipLib.Zip.FastZipEvents2();
        events.TotalProgress    = this.TotalProgressHandler;
        events.TotalFinish      = this.FinishHandler;
        events.Progress         = this.ProgressHandler;
        events.ProgressInterval = TimeSpan.FromSeconds(0.5);
        events.FileFailure      = this.ErrorHandler;
        events.DirectoryFailure = this.ErrorHandler;

        mZip2           = new ICSharpCode.SharpZipLib.Zip.FastZip2(events);
        mZipStream      = zipStream;
        mTargetDir      = targetDir;
        extractFromFile = false;
    }
Example #3
0
    public static void Unzip(Stream zipStream,
                             string targetDir,
                             ICSharpCode.SharpZipLib.Core.TotalProgressHandler hTotalProgress       = null,
                             ICSharpCode.SharpZipLib.Core.ProcessDirectoryHandler hProcessDirectory = null,
                             ICSharpCode.SharpZipLib.Core.ProcessFileHandler hProcessFile           = null,
                             ICSharpCode.SharpZipLib.Core.ProgressHandler hProgress                 = null,
                             ICSharpCode.SharpZipLib.Core.CompletedFileHandler hCompletedFile       = null,
                             ICSharpCode.SharpZipLib.Core.DirectoryFailureHandler hDirectoryFailure = null,
                             ICSharpCode.SharpZipLib.Core.FileFailureHandler hFileFailure           = null)
    {
        ICSharpCode.SharpZipLib.Zip.FastZipEvents2 events = new ICSharpCode.SharpZipLib.Zip.FastZipEvents2();
        events.TotalProgress    = hTotalProgress;
        events.ProcessDirectory = hProcessDirectory;
        events.ProcessFile      = hProcessFile;
        events.Progress         = hProgress;
        events.CompletedFile    = hCompletedFile;
        events.DirectoryFailure = hDirectoryFailure;
        events.FileFailure      = hFileFailure;
        events.ProgressInterval = TimeSpan.FromSeconds(0.5);

        mZip2 = new ICSharpCode.SharpZipLib.Zip.FastZip2(events);
        mZip2.ExtractZip(zipStream, targetDir, ICSharpCode.SharpZipLib.Zip.FastZip2.Overwrite.Always, null, null, null, true, true);
    }
Example #4
0
 /// <summary>
 /// Initialise a new instance of <see cref="FastZip2"/>
 /// </summary>
 /// <param name="events">The <see cref="FastZipEvents2">events</see> to use during operations.</param>
 public FastZip2(FastZipEvents2 events)
 {
     events_ = events;
 }