mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-09 02:16:46 +00:00
Downstream changes from Serialization for now
This commit is contained in:
@@ -44,9 +44,17 @@ namespace BinaryObjectScanner.FileType
|
||||
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
|
||||
var zipFile = ZipArchive.Open(stream, readerOptions);
|
||||
|
||||
// Try to read the file path if no entries are found
|
||||
if (zipFile.Entries.Count == 0 && !string.IsNullOrEmpty(file) && File.Exists(file))
|
||||
zipFile = ZipArchive.Open(file, readerOptions);
|
||||
// If the file exists
|
||||
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
|
||||
{
|
||||
// Try to read the file path if no entries are found
|
||||
if (zipFile.Entries.Count == 0)
|
||||
zipFile = ZipArchive.Open(file!, readerOptions);
|
||||
|
||||
// If there's any multipart items, try reading the file as well
|
||||
else if (!zipFile.IsComplete)
|
||||
zipFile = ZipArchive.Open(file!, readerOptions);
|
||||
}
|
||||
|
||||
foreach (var entry in zipFile.Entries)
|
||||
{
|
||||
|
||||
@@ -45,9 +45,17 @@ namespace BinaryObjectScanner.FileType
|
||||
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
|
||||
RarArchive rarFile = RarArchive.Open(stream, readerOptions);
|
||||
|
||||
// Try to read the file path if no entries are found
|
||||
if (rarFile.Entries.Count == 0 && !string.IsNullOrEmpty(file) && File.Exists(file))
|
||||
rarFile = RarArchive.Open(file, readerOptions);
|
||||
// If the file exists
|
||||
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
|
||||
{
|
||||
// Try to read the file path if no entries are found
|
||||
if (rarFile.Entries.Count == 0)
|
||||
rarFile = RarArchive.Open(file!, readerOptions);
|
||||
|
||||
// If there's any multipart items, try reading the file as well
|
||||
else if (!rarFile.IsComplete)
|
||||
rarFile = RarArchive.Open(file!, readerOptions);
|
||||
}
|
||||
|
||||
if (!rarFile.IsComplete)
|
||||
return false;
|
||||
|
||||
@@ -44,9 +44,18 @@ namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
|
||||
var sevenZip = SevenZipArchive.Open(stream, readerOptions);
|
||||
// Try to read the file path if no entries are found
|
||||
if (sevenZip.Entries.Count == 0 && !string.IsNullOrEmpty(file) && File.Exists(file))
|
||||
sevenZip = SevenZipArchive.Open(file, readerOptions);
|
||||
|
||||
// If the file exists
|
||||
if (!string.IsNullOrEmpty(file) && File.Exists(file!))
|
||||
{
|
||||
// Try to read the file path if no entries are found
|
||||
if (sevenZip.Entries.Count == 0)
|
||||
sevenZip = SevenZipArchive.Open(file!, readerOptions);
|
||||
|
||||
// If there's any multipart items, try reading the file as well
|
||||
else if (!sevenZip.IsComplete)
|
||||
sevenZip = SevenZipArchive.Open(file!, 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.
|
||||
|
||||
Reference in New Issue
Block a user