Order of operations

This commit is contained in:
Matt Nadareski
2025-08-26 06:53:08 -04:00
parent 1b2c62da9a
commit 29bd888052
4 changed files with 19 additions and 19 deletions

View File

@@ -50,12 +50,12 @@ namespace BinaryObjectScanner.FileType
// Find all file parts
FileInfo[] parts = [.. ArchiveFactory.GetFileParts(new FileInfo(file))];
// Try to read the file path if no entries are found
if (zipFile.Entries.Count == 0)
// If there are multiple parts
if (parts.Length > 1)
zipFile = ZipArchive.Open(parts, readerOptions);
// If there are multiple parts
else if (parts.Length > 1)
// Try to read the file path if no entries are found
else if (zipFile.Entries.Count == 0)
zipFile = ZipArchive.Open(parts, readerOptions);
}

View File

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

View File

@@ -50,13 +50,13 @@ namespace BinaryObjectScanner.FileType
{
// Find all file parts
FileInfo[] parts = [.. ArchiveFactory.GetFileParts(new FileInfo(file))];
// If there are multiple parts
if (parts.Length > 1)
sevenZip = SevenZipArchive.Open(parts, readerOptions);
// 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 (parts.Length > 1)
else if (sevenZip.Entries.Count == 0)
sevenZip = SevenZipArchive.Open(parts, readerOptions);
}

View File

@@ -93,12 +93,12 @@ namespace ExtractionTool
// Get the file type
WrapperType ft = WrapperFactory.GetFileType(magic, extension);
var wrapper = WrapperFactory.CreateWrapper(ft, stream);
if (wrapper == null)
{
Console.WriteLine("Could not determine the file format, skipping...");
Console.WriteLine();
return;
}
// if (wrapper == null)
// {
// Console.WriteLine("Could not determine the file format, skipping...");
// Console.WriteLine();
// return;
// }
// Create the output directory
Directory.CreateDirectory(outputDirectory);