Use file part count, not partial files

This commit is contained in:
Matt Nadareski
2025-08-26 06:41:07 -04:00
parent c95890aae5
commit 1b2c62da9a
3 changed files with 7 additions and 7 deletions

View File

@@ -48,14 +48,14 @@ namespace BinaryObjectScanner.FileType
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
{
// Find all file parts
var parts = ArchiveFactory.GetFileParts(new FileInfo(file));
FileInfo[] parts = [.. ArchiveFactory.GetFileParts(new FileInfo(file))];
// Try to read the file path if no entries are found
if (zipFile.Entries.Count == 0)
zipFile = ZipArchive.Open(parts, readerOptions);
// If there's any multipart items, try reading the file as well
else if (!zipFile.IsComplete)
// If there are multiple parts
else if (parts.Length > 1)
zipFile = ZipArchive.Open(parts, readerOptions);
}

View File

@@ -49,14 +49,14 @@ namespace BinaryObjectScanner.FileType
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
{
// Find all file parts
var parts = ArchiveFactory.GetFileParts(new FileInfo(file));
FileInfo[] parts = [.. ArchiveFactory.GetFileParts(new FileInfo(file))];
// Try to read the file path if no entries are found
if (rarFile.Entries.Count == 0)
rarFile = RarArchive.Open(parts, readerOptions);
// If there's any multipart items, try reading the file as well
else if (!rarFile.IsComplete)
else if (parts.Length > 1)
rarFile = RarArchive.Open(parts, readerOptions);
}

View File

@@ -49,14 +49,14 @@ namespace BinaryObjectScanner.FileType
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
{
// Find all file parts
var parts = ArchiveFactory.GetFileParts(new FileInfo(file));
FileInfo[] parts = [.. ArchiveFactory.GetFileParts(new FileInfo(file))];
// Try to read the file path if no entries are found
if (sevenZip.Entries.Count == 0)
sevenZip = SevenZipArchive.Open(parts, readerOptions);
// If there's any multipart items, try reading the file as well
else if (!sevenZip.IsComplete)
else if (parts.Length > 1)
sevenZip = SevenZipArchive.Open(parts, readerOptions);
}