From 3f85c94bd2eb8511454418739c50542a1cb5d3e2 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 1 Nov 2018 18:28:28 +0000 Subject: [PATCH] Merged PR 5608: Use ZipFile and ExtractToDirectory APIs to extract zip file Use ZipFile and ExtractToDirectory APIs to extract zip file --- .../help/UpdatableHelpSystem.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/System.Management.Automation/help/UpdatableHelpSystem.cs b/src/System.Management.Automation/help/UpdatableHelpSystem.cs index 51b1b65473..f190f7bc8f 100644 --- a/src/System.Management.Automation/help/UpdatableHelpSystem.cs +++ b/src/System.Management.Automation/help/UpdatableHelpSystem.cs @@ -1252,14 +1252,9 @@ namespace System.Management.Automation.Help try { - using (FileStream archiveFileStream = new FileStream(source, IO.FileMode.Open, FileAccess.Read)) - using (ZipArchive zipArchive = new ZipArchive(archiveFileStream, ZipArchiveMode.Read, false)) + using (ZipArchive zipArchive = ZipFile.Open(source, ZipArchiveMode.Read)) { - foreach (ZipArchiveEntry entry in zipArchive.Entries) - { - string extractPath = Path.Combine(destination, entry.FullName); - entry.ExtractToFile(extractPath); - } + zipArchive.ExtractToDirectory(destination); sucessfulDecompression = true; } }