public void UnzipArchive(byte[] zipArchive, string rootPath, IProgress <double> progress = null) { zipArchive.AssertNotNull(nameof(zipArchive)); rootPath.AssertHasText(nameof(rootPath)); IList <Tuple <string, byte[]> > files = Zipper.GetFileContentsFromZipFile(zipArchive); double singleFileReportValue = 1 / (double)files.Count * 100; object lockObj = new object(); double reportSumValue = 0; Parallel .ForEach ( files, file => { string filePath = Path.Combine(rootPath, file.Item1); Directory.CreateDirectory(Path.GetDirectoryName(filePath)); File.WriteAllBytes(filePath, file.Item2); if (progress.IsNotNull()) { lock (lockObj) { reportSumValue += singleFileReportValue; progress.Report(reportSumValue); } } } ); progress.Report(100); }