From 0a8d8eb59532a83996958556ec28d48a31495ff5 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 11 Jul 2023 11:54:07 +0100 Subject: [PATCH] Fix issue with 0 size components --- src/Helpers.cs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Helpers.cs b/src/Helpers.cs index 8519b28..38e4c5c 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -314,26 +314,26 @@ public static void ExtractComponent(Stream stream, Component component) string.Join(" ", new[] { component.Hash, $"{component.InstallSize}" }.Concat(component.Depends).ToArray()) }; - if (component.InstallSize == 0) return; - - using (var reader = ZipArchive.Open(stream).ExtractAllEntries()) + if (component.InstallSize != 0) { - while (reader.MoveToNextEntry()) + using (var reader = ZipArchive.Open(stream).ExtractAllEntries()) { - if (reader.Entry.IsDirectory) continue; + while (reader.MoveToNextEntry()) + { + if (reader.Entry.IsDirectory) continue; - string destPath = Path.Combine(Common.Path, component.Directory.Replace('/', Path.DirectorySeparatorChar)); + string destPath = Path.Combine(Common.Path, component.Directory.Replace('/', Path.DirectorySeparatorChar)); - Directory.CreateDirectory(destPath); + Directory.CreateDirectory(destPath); - reader.WriteEntryToDirectory(destPath, new ExtractionOptions - { - ExtractFullPath = true, - Overwrite = true, - PreserveFileTime = true - }); + reader.WriteEntryToDirectory(destPath, new ExtractionOptions { + ExtractFullPath = true, + Overwrite = true, + PreserveFileTime = true + }); - infoContents.Add(Path.Combine(component.Directory, reader.Entry.Key).Replace('/', Path.DirectorySeparatorChar)); + infoContents.Add(Path.Combine(component.Directory, reader.Entry.Key).Replace('/', Path.DirectorySeparatorChar)); + } } }