Handle archive parts

This commit is contained in:
Matt Nadareski
2025-08-25 22:20:19 -04:00
parent 58022ec328
commit c95890aae5
3 changed files with 15 additions and 6 deletions

View File

@@ -47,13 +47,16 @@ namespace BinaryObjectScanner.FileType
// If the file exists
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
{
// Find all file parts
var 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(file!, readerOptions);
zipFile = ZipArchive.Open(parts, readerOptions);
// If there's any multipart items, try reading the file as well
else if (!zipFile.IsComplete)
zipFile = ZipArchive.Open(file!, readerOptions);
zipFile = ZipArchive.Open(parts, readerOptions);
}
foreach (var entry in zipFile.Entries)

View File

@@ -48,13 +48,16 @@ namespace BinaryObjectScanner.FileType
// If the file exists
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
{
// Find all file parts
var 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(file!, readerOptions);
rarFile = RarArchive.Open(parts, readerOptions);
// If there's any multipart items, try reading the file as well
else if (!rarFile.IsComplete)
rarFile = RarArchive.Open(file!, readerOptions);
rarFile = RarArchive.Open(parts, readerOptions);
}
if (rarFile.IsSolid)

View File

@@ -48,13 +48,16 @@ namespace BinaryObjectScanner.FileType
// If the file exists
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
{
// Find all file parts
var 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(file!, readerOptions);
sevenZip = SevenZipArchive.Open(parts, readerOptions);
// If there's any multipart items, try reading the file as well
else if (!sevenZip.IsComplete)
sevenZip = SevenZipArchive.Open(file!, readerOptions);
sevenZip = SevenZipArchive.Open(parts, readerOptions);
}
// Currently doesn't flag solid 7z archives with only 1 solid block as solid, but practically speaking