Пример #1
0
        private static void UnzipFile(FileInfo zipFIle, string outFolder, UnzipProgressCallback progressCallback)
        {
            var events = new FastZipEvents();

            events.Progress += UnzipProgressHandler;

            var fastZip = new FastZip(events);

            try
            {
                fastZip.ExtractZip(zipFIle.OpenRead(), outFolder, FastZip.Overwrite.Always, null, null, null, true, true);
            }
            catch (Exception e)
            {
                throw new DiskCleanupException(e.Message, e);
            }

            zipFIle.Delete();

            void UnzipProgressHandler(object sender, ProgressEventArgs e)
            {
                progressCallback?.Invoke(e.Name, e.PercentComplete);
            }
        }