mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-28 17:37:20 +00:00
Try reading files if streams fail
This commit is contained in:
@@ -42,7 +42,12 @@ namespace BinaryObjectScanner.FileType
|
||||
try
|
||||
{
|
||||
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
|
||||
using var zipFile = ZipArchive.Open(stream, readerOptions);
|
||||
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);
|
||||
|
||||
foreach (var entry in zipFile.Entries)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -42,7 +42,12 @@ namespace BinaryObjectScanner.FileType
|
||||
try
|
||||
{
|
||||
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
|
||||
using RarArchive rarFile = RarArchive.Open(stream, readerOptions);
|
||||
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 (!rarFile.IsComplete)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -42,7 +42,12 @@ namespace BinaryObjectScanner.FileType
|
||||
try
|
||||
{
|
||||
var readerOptions = new ReaderOptions() { LookForHeader = lookForHeader };
|
||||
using var sevenZip = SevenZipArchive.Open(stream, readerOptions);
|
||||
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);
|
||||
|
||||
foreach (var entry in sevenZip.Entries)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -32,7 +32,12 @@ namespace BinaryObjectScanner.FileType
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
try
|
||||
{
|
||||
using var tarFile = TarArchive.Open(stream);
|
||||
var tarFile = TarArchive.Open(stream);
|
||||
|
||||
// Try to read the file path if no entries are found
|
||||
if (tarFile.Entries.Count == 0 && !string.IsNullOrEmpty(file) && File.Exists(file))
|
||||
tarFile = TarArchive.Open(file);
|
||||
|
||||
foreach (var entry in tarFile.Entries)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user