diff --git a/SabreTools.Serialization/Wrappers/PKZIP.cs b/SabreTools.Serialization/Wrappers/PKZIP.cs index 8f8f1d06..bd0d0fc7 100644 --- a/SabreTools.Serialization/Wrappers/PKZIP.cs +++ b/SabreTools.Serialization/Wrappers/PKZIP.cs @@ -100,9 +100,17 @@ namespace SabreTools.Serialization.Wrappers var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader }; var zipFile = ZipArchive.Open(_dataSource, readerOptions); - // Try to read the file path if no entries are found - if (zipFile.Entries.Count == 0 && !string.IsNullOrEmpty(Filename) && File.Exists(Filename!)) - zipFile = ZipArchive.Open(Filename!, readerOptions); + // If the file exists + if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!)) + { + // Try to read the file path if no entries are found + if (zipFile.Entries.Count == 0) + zipFile = ZipArchive.Open(Filename!, readerOptions); + + // If there's any multipart items, try reading the file as well + else if (System.Array.Exists([.. zipFile.Entries], e => !e.IsComplete)) + zipFile = ZipArchive.Open(Filename!, readerOptions); + } foreach (var entry in zipFile.Entries) { diff --git a/SabreTools.Serialization/Wrappers/RAR.cs b/SabreTools.Serialization/Wrappers/RAR.cs index 8a656e4c..d5ca2027 100644 --- a/SabreTools.Serialization/Wrappers/RAR.cs +++ b/SabreTools.Serialization/Wrappers/RAR.cs @@ -103,9 +103,17 @@ namespace SabreTools.Serialization.Wrappers var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader }; RarArchive rarFile = RarArchive.Open(_dataSource, readerOptions); - // Try to read the file path if no entries are found - if (rarFile.Entries.Count == 0 && !string.IsNullOrEmpty(Filename) && File.Exists(Filename!)) - rarFile = RarArchive.Open(Filename!, readerOptions); + // If the file exists + if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!)) + { + // Try to read the file path if no entries are found + if (rarFile.Entries.Count == 0) + rarFile = RarArchive.Open(Filename!, readerOptions); + + // If there's any multipart items, try reading the file as well + else if (System.Array.Exists([.. rarFile.Entries], e => !e.IsComplete)) + rarFile = RarArchive.Open(Filename!, readerOptions); + } if (!rarFile.IsComplete) return false; diff --git a/SabreTools.Serialization/Wrappers/SevenZip.cs b/SabreTools.Serialization/Wrappers/SevenZip.cs index c877fd74..41b2dcb8 100644 --- a/SabreTools.Serialization/Wrappers/SevenZip.cs +++ b/SabreTools.Serialization/Wrappers/SevenZip.cs @@ -102,9 +102,18 @@ namespace SabreTools.Serialization.Wrappers { var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader }; var sevenZip = SevenZipArchive.Open(_dataSource, readerOptions); - // Try to read the file path if no entries are found - if (sevenZip.Entries.Count == 0 && !string.IsNullOrEmpty(Filename) && File.Exists(Filename!)) - sevenZip = SevenZipArchive.Open(Filename!, readerOptions); + + // If the file exists + if (!string.IsNullOrEmpty(Filename) && File.Exists(Filename!)) + { + // Try to read the file path if no entries are found + if (sevenZip.Entries.Count == 0) + sevenZip = SevenZipArchive.Open(Filename!, readerOptions); + + // If there's any multipart items, try reading the file as well + else if (System.Array.Exists([.. sevenZip.Entries], e => !e.IsComplete)) + sevenZip = SevenZipArchive.Open(Filename!, readerOptions); + } // Currently doesn't flag solid 7z archives with only 1 solid block as solid, but practically speaking // this is not much of a concern.