Implementations act the same

This commit is contained in:
Matt Nadareski
2023-03-09 15:07:35 -05:00
parent 6e5d517e82
commit f6157ef79b
25 changed files with 83 additions and 1484 deletions

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// BFPK custom archive format
/// </summary>
public class BFPK : IExtractable, IScannable
public class BFPK : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the BFPK file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Half-Life Level
/// </summary>
public class BSP : IExtractable, IScannable
public class BSP : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -42,54 +39,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the BSP file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Compressors;
using SharpCompress.Compressors.BZip2;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// bzip2 archive
/// </summary>
public class BZip2 : IExtractable, IScannable
public class BZip2 : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -44,54 +41,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the BZip2 file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Text;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using OpenMcdf;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Compound File Binary
/// </summary>
public class CFB : IExtractable, IScannable
public class CFB : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -71,56 +68,6 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
// TODO: Add stream opening support
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the MSI file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
/// <remarks>Adapted from LibMSI</remarks>
public static string DecodeStreamName(string input)
{

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Half-Life Game Cache File
/// </summary>
public class GCF : IExtractable, IScannable
public class GCF : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the GCF file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Archives;
using SharpCompress.Archives.GZip;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// gzip archive
/// </summary>
public class GZIP : IExtractable, IScannable
public class GZIP : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -48,54 +45,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the gzip file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using UnshieldSharp.Archive;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// InstallShield archive v3
/// </summary>
public class InstallShieldArchiveV3 : IExtractable, IScannable
public class InstallShieldArchiveV3 : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -52,55 +49,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
// TODO: Add stream opening support
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the archive itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Text.RegularExpressions;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using UnshieldSharp.Cabinet;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// InstallShield cabinet file
/// </summary>
public class InstallShieldCAB : IExtractable, IScannable
public class InstallShieldCAB : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -71,55 +68,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
// TODO: Add stream opening support
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the cab file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,19 +1,16 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
#if NET48
using StormLibSharp;
#endif
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// MoPaQ game data archive
/// </summary>
public class MPQ : IExtractable, IScannable
public class MPQ : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -68,61 +65,6 @@ namespace BurnOutSharp.FileType
}
return tempPath;
#endif
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
// TODO: Add stream opening support
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
#if NET6_0_OR_GREATER
// Not supported for .NET 6.0 due to Windows DLL requirements
return null;
#else
// If the MPQ file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
#endif
}
}

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Wrappers;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
@@ -13,7 +10,7 @@ namespace BurnOutSharp.FileType
/// </summary>
/// <remarks>Specification available at <see href="http://download.microsoft.com/download/5/0/1/501ED102-E53F-4CE0-AA6B-B0F93629DDC6/Exchange/%5BMS-CAB%5D.pdf"/></remarks>
/// <see href="https://github.com/wine-mirror/wine/tree/master/dlls/cabinet"/>
public class MicrosoftCAB : IExtractable, IScannable
public class MicrosoftCAB : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -46,54 +43,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the cab file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BinaryObjectScanner.Compression;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
@@ -12,7 +9,7 @@ namespace BurnOutSharp.FileType
/// Microsoft LZ-compressed Files (LZ32)
/// </summary>
/// <remarks>This is treated like an archive type due to the packing style</remarks>
public class MicrosoftLZ : IExtractable, IScannable
public class MicrosoftLZ : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -57,54 +54,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the LZ file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Half-Life Package File
/// </summary>
public class PAK : IExtractable, IScannable
public class PAK : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the PAK file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// NovaLogic Game Archive Format
/// </summary>
public class PFF : IExtractable, IScannable
public class PFF : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the PFF file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// PKWARE ZIP archive and derivatives
/// </summary>
public class PKZIP : IExtractable, IScannable
public class PKZIP : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -49,54 +46,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the zip file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Archives;
using SharpCompress.Archives.Rar;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// RAR archive
/// </summary>
public class RAR : IExtractable, IScannable
public class RAR : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -48,73 +45,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the rar file itself fails
try
{
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(tempPath);
using (RarArchive rarFile = RarArchive.Open(stream))
{
foreach (var entry in rarFile.Entries)
{
// If an individual entry fails
try
{
// If we have a directory, skip it
if (entry.IsDirectory)
continue;
string tempFile = Path.Combine(tempPath, entry.Key);
entry.WriteToFile(tempFile);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
}
}
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// SGA game archive
/// </summary>
public class SGA : IExtractable, IScannable
public class SGA : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the SGA file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Archives;
using SharpCompress.Archives.SevenZip;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// 7-zip archive
/// </summary>
public class SevenZip : IExtractable, IScannable
public class SevenZip : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -48,54 +45,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the 7-zip file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,18 +1,15 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Archives;
using SharpCompress.Archives.Tar;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Tape archive
/// </summary>
public class TapeArchive : IExtractable, IScannable
public class TapeArchive : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -48,54 +45,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the tar file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Half-Life 2 Level
/// </summary>
public class VBSP : IExtractable, IScannable
public class VBSP : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the VBSP file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Valve Package File
/// </summary>
public class VPK : IExtractable, IScannable
public class VPK : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the VPK file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// Half-Life Texture Package File
/// </summary>
public class WAD : IExtractable, IScannable
public class WAD : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the WAD file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,17 +1,14 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using SharpCompress.Compressors.Xz;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// xz archive
/// </summary>
public class XZ : IExtractable, IScannable
public class XZ : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -43,54 +40,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the xz file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -1,16 +1,13 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Interfaces;
using static BinaryObjectScanner.Utilities.Dictionary;
namespace BurnOutSharp.FileType
{
/// <summary>
/// XBox Package File
/// </summary>
public class XZP : IExtractable, IScannable
public class XZP : IExtractable
{
/// <inheritdoc/>
public string Extract(string file)
@@ -41,54 +38,5 @@ namespace BurnOutSharp.FileType
return tempPath;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
// If the XZP file itself fails
try
{
// Extract and get the output path
string tempPath = Extract(stream, file);
if (tempPath == null)
return null;
// Collect and format all found protections
var protections = scanner.GetProtections(tempPath);
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
// Remove temporary path references
StripFromKeys(protections, tempPath);
return protections;
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -341,255 +341,59 @@ namespace BurnOutSharp
if (fileType == SupportedFileType.UNKNOWN)
return null;
// Create a scannable for the given file type
var scannable = Tools.Utilities.CreateScannable(fileType);
if (scannable == null)
return null;
#region Non-Archive File Types
// Create a scannable for the given file type
var scannable = Tools.Utilities.CreateScannable(fileType);
// If we're scanning file contents
if (ScanContents)
if (scannable != null && ScanContents)
{
// AACS media key block
if (scannable is AACSMediaKeyBlock)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
// BD+ SVM
if (scannable is BDPlusSVM)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
// Executable
if (scannable is Executable)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
// LDSCRYPT
if (scannable is LDSCRYPT)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
// PLJ
if (scannable is PLJ)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
// SFFS
if (scannable is SFFS)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
// Text-based files
if (scannable is Textfile)
{
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
var subProtections = scannable.Scan(this, stream, fileName);
AppendToDictionary(protections, subProtections);
}
#endregion
#region Archive File Types
// Create an extractable for the given file type
var extractable = Tools.Utilities.CreateExtractable(fileType);
// If we're scanning archives
if (ScanArchives)
if (extractable != null && ScanArchives)
{
// 7-Zip archive
if (scannable is SevenZip)
// If the archive file itself fails
try
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// Extract and get the output path
string tempPath = extractable.Extract(stream, fileName);
if (tempPath == null)
return null;
// BFPK archive
if (scannable is BFPK)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// Collect and format all found protections
var subProtections = GetProtections(tempPath);
// BSP
if (scannable is BSP)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// If temp directory cleanup fails
try
{
Directory.Delete(tempPath, true);
}
catch (Exception ex)
{
if (IncludeDebug) Console.WriteLine(ex);
}
// BZip2
if (scannable is BZip2)
{
var subProtections = scannable.Scan(this, stream, fileName);
// Prepare the returned protections
StripFromKeys(protections, tempPath);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// CFB
if (fileName != null && scannable is CFB)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
return protections;
}
// GCF
if (scannable is GCF)
catch (Exception ex)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// GZIP
if (scannable is GZIP)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// InstallShield Archive V3 (Z)
if (fileName != null && scannable is InstallShieldArchiveV3)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// InstallShield Cabinet
if (fileName != null && scannable is InstallShieldCAB)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// Microsoft Cabinet
if (fileName != null && scannable is MicrosoftCAB)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// Microsoft LZ
if (fileName != null && scannable is MicrosoftLZ)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// MoPaQ archive
if (fileName != null && scannable is MPQ)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// PAK
if (fileName != null && scannable is PAK)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// PFF
if (fileName != null && scannable is PFF)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// PKZIP archive (and derivatives)
if (scannable is PKZIP)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// RAR archive
if (scannable is RAR)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// SGA
if (scannable is SGA)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// Tape Archive
if (scannable is TapeArchive)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// VBSP
if (fileName != null && scannable is VBSP)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// VPK
if (fileName != null && scannable is VPK)
{
var subProtections = scannable.Scan(this, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// WAD
if (scannable is WAD)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// XZ
if (scannable is XZ)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
}
// XZP
if (scannable is XZP)
{
var subProtections = scannable.Scan(this, stream, fileName);
PrependToKeys(subProtections, fileName);
AppendToDictionary(protections, subProtections);
if (IncludeDebug) Console.WriteLine(ex);
}
}

View File

@@ -5,6 +5,7 @@ using BurnOutSharp.Interfaces;
using BinaryObjectScanner.Matching;
using BinaryObjectScanner.Utilities;
using BinaryObjectScanner.Wrappers;
using BinaryObjectScanner.Interfaces;
namespace BurnOutSharp.Tools
{
@@ -788,26 +789,22 @@ namespace BurnOutSharp.Tools
}
/// <summary>
/// Create an instance of a scannable based on file type
/// Create an instance of an extractable based on file type
/// </summary>
public static IScannable CreateScannable(SupportedFileType fileType)
public static IExtractable CreateExtractable(SupportedFileType fileType)
{
switch (fileType)
{
case SupportedFileType.AACSMediaKeyBlock: return new FileType.AACSMediaKeyBlock();
case SupportedFileType.BDPlusSVM: return new FileType.BDPlusSVM();
case SupportedFileType.BFPK: return new FileType.BFPK();
case SupportedFileType.BSP: return new FileType.BSP();
case SupportedFileType.BZip2: return new FileType.BZip2();
case SupportedFileType.CFB: return new FileType.CFB();
//case SupportedFileType.CIA: return new FileType.CIA();
case SupportedFileType.Executable: return new FileType.Executable();
//case SupportedFileType.Executable: return new FileType.Executable();
case SupportedFileType.GCF: return new FileType.GCF();
case SupportedFileType.GZIP: return new FileType.GZIP();
//case FileTypes.IniFile: return new FileType.IniFile();
case SupportedFileType.InstallShieldArchiveV3: return new FileType.InstallShieldArchiveV3();
case SupportedFileType.InstallShieldCAB: return new FileType.InstallShieldCAB();
case SupportedFileType.LDSCRYPT: return new FileType.LDSCRYPT();
case SupportedFileType.MicrosoftCAB: return new FileType.MicrosoftCAB();
case SupportedFileType.MicrosoftLZ: return new FileType.MicrosoftLZ();
case SupportedFileType.MPQ: return new FileType.MPQ();
@@ -817,14 +814,13 @@ namespace BurnOutSharp.Tools
case SupportedFileType.PAK: return new FileType.PAK();
case SupportedFileType.PFF: return new FileType.PFF();
case SupportedFileType.PKZIP: return new FileType.PKZIP();
case SupportedFileType.PLJ: return new FileType.PLJ();
//case SupportedFileType.PLJ: return new FileType.PLJ();
//case SupportedFileType.Quantum: return new FileType.Quantum();
case SupportedFileType.RAR: return new FileType.RAR();
case SupportedFileType.SevenZip: return new FileType.SevenZip();
case SupportedFileType.SFFS: return new FileType.SFFS();
case SupportedFileType.SGA: return new FileType.SGA();
case SupportedFileType.TapeArchive: return new FileType.TapeArchive();
case SupportedFileType.Textfile: return new FileType.Textfile();
case SupportedFileType.VBSP: return new FileType.VBSP();
case SupportedFileType.VPK: return new FileType.VPK();
case SupportedFileType.WAD: return new FileType.WAD();
@@ -834,6 +830,29 @@ namespace BurnOutSharp.Tools
}
}
/// <summary>
/// Create an instance of a scannable based on file type
/// </summary>
public static IScannable CreateScannable(SupportedFileType fileType)
{
switch (fileType)
{
case SupportedFileType.AACSMediaKeyBlock: return new FileType.AACSMediaKeyBlock();
case SupportedFileType.BDPlusSVM: return new FileType.BDPlusSVM();
//case SupportedFileType.CIA: return new FileType.CIA();
case SupportedFileType.Executable: return new FileType.Executable();
//case FileTypes.IniFile: return new FileType.IniFile();
case SupportedFileType.LDSCRYPT: return new FileType.LDSCRYPT();
//case SupportedFileType.N3DS: return new FileType.N3DS();
//case SupportedFileType.NCF: return new FileType.NCF();
//case SupportedFileType.Nitro: return new FileType.Nitro();
case SupportedFileType.PLJ: return new FileType.PLJ();
case SupportedFileType.SFFS: return new FileType.SFFS();
case SupportedFileType.Textfile: return new FileType.Textfile();
default: return null;
}
}
/// <summary>
/// Create an instance of a wrapper based on file type
/// </summary>