Simplify using new base class

This commit is contained in:
Matt Nadareski
2025-09-06 11:35:37 -04:00
parent 8043201be7
commit 00db772594
56 changed files with 360 additions and 455 deletions

View File

@@ -58,39 +58,39 @@ namespace BinaryObjectScanner.Test
private static readonly List<WrapperType> _extractableTypes =
[
WrapperType.BFPK,
WrapperType.BSP,
WrapperType.BZip2,
WrapperType.CFB,
//WrapperType.CIA,
//WrapperType.Executable, // TODO: This needs to be split internally
WrapperType.GCF,
WrapperType.GZip,
WrapperType.InstallShieldArchiveV3,
WrapperType.InstallShieldCAB,
WrapperType.LZKWAJ,
WrapperType.LZQBasic,
WrapperType.LZSZDD,
WrapperType.MicrosoftCAB,
WrapperType.MoPaQ,
//WrapperType.N3DS,
//WrapperType.NCF,
//WrapperType.Nitro,
WrapperType.PAK,
WrapperType.PFF,
WrapperType.PKZIP,
//WrapperType.PlayJAudioFile, // TODO: Create wrapper to reenable test
//WrapperType.Quantum,
WrapperType.RAR,
WrapperType.SevenZip,
// WrapperType.BFPK, // TODO: Create wrapper to reenable test
// WrapperType.BSP, // TODO: Create wrapper to reenable test
// WrapperType.BZip2, // TODO: Create wrapper to reenable test
// WrapperType.CFB, // TODO: Create wrapper to reenable test
// WrapperType.CIA,
// WrapperType.Executable, // TODO: This needs to be split internally
// WrapperType.GCF, // TODO: Create wrapper to reenable test
// WrapperType.GZip, // TODO: Create wrapper to reenable test
// WrapperType.InstallShieldArchiveV3, // TODO: Create wrapper to reenable test
// WrapperType.InstallShieldCAB, // TODO: Create wrapper to reenable test
// WrapperType.LZKWAJ, // TODO: Create wrapper to reenable test
// WrapperType.LZQBasic, // TODO: Create wrapper to reenable test
// WrapperType.LZSZDD, // TODO: Create wrapper to reenable test
// WrapperType.MicrosoftCAB, // TODO: Create wrapper to reenable test
// WrapperType.MoPaQ, // TODO: Create wrapper to reenable test
// WrapperType.N3DS,
// WrapperType.NCF,
// WrapperType.Nitro,
// WrapperType.PAK, // TODO: Create wrapper to reenable test
// WrapperType.PFF, // TODO: Create wrapper to reenable test
// WrapperType.PKZIP, // TODO: Create wrapper to reenable test
// WrapperType.PlayJAudioFile, // TODO: Create wrapper to reenable test
// WrapperType.Quantum, // TODO: Create wrapper to reenable test
// WrapperType.RAR, // TODO: Create wrapper to reenable test
// WrapperType.SevenZip, // TODO: Create wrapper to reenable test
WrapperType.SFFS,
WrapperType.SGA,
WrapperType.TapeArchive,
WrapperType.VBSP,
WrapperType.VPK,
WrapperType.WAD,
WrapperType.XZ,
WrapperType.XZP,
// WrapperType.SGA, // TODO: Create wrapper to reenable test
// WrapperType.TapeArchive, // TODO: Create wrapper to reenable test
// WrapperType.VBSP, // TODO: Create wrapper to reenable test
// WrapperType.VPK, // TODO: Create wrapper to reenable test
// WrapperType.WAD, // TODO: Create wrapper to reenable test
// WrapperType.XZ, // TODO: Create wrapper to reenable test
// WrapperType.XZP, // TODO: Create wrapper to reenable test
];
[Theory]

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class BFPKTests
{
private static readonly SabreTools.Serialization.Wrappers.BFPK wrapper
= new(new SabreTools.Models.BFPK.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BFPK();
var extractable = new BFPK(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BFPK();
var extractable = new BFPK(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BFPK();
var extractable = new BFPK(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class BSPTests
{
private static readonly SabreTools.Serialization.Wrappers.BSP wrapper
= new(new SabreTools.Models.BSP.BspFile(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BSP();
var extractable = new BSP(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BSP();
var extractable = new BSP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BSP();
var extractable = new BSP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class BZip2Tests
{
private static readonly SabreTools.Serialization.Wrappers.BZip2 wrapper
= new(new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BZip2();
var extractable = new BZip2(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BZip2();
var extractable = new BZip2(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new BZip2();
var extractable = new BZip2(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class CFBTests
{
private static readonly SabreTools.Serialization.Wrappers.CFB wrapper
= new(new SabreTools.Models.CFB.Binary(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new CFB();
var extractable = new CFB(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new CFB();
var extractable = new CFB(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new CFB();
var extractable = new CFB(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class GCFTests
{
private static readonly SabreTools.Serialization.Wrappers.GCF wrapper
= new(new SabreTools.Models.GCF.File(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new GCF();
var extractable = new GCF(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new GCF();
var extractable = new GCF(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new GCF();
var extractable = new GCF(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class GZIPTests
{
private static readonly SabreTools.Serialization.Wrappers.GZip wrapper
= new(new SabreTools.Models.GZIP.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new GZip();
var extractable = new GZip(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new GZip();
var extractable = new GZip(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new GZip();
var extractable = new GZip(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class InstallShieldArchiveV3Tests
{
private static readonly SabreTools.Serialization.Wrappers.InstallShieldArchiveV3 wrapper
= new(new SabreTools.Models.InstallShieldArchiveV3.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new InstallShieldArchiveV3();
var extractable = new InstallShieldArchiveV3(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new InstallShieldArchiveV3();
var extractable = new InstallShieldArchiveV3(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new InstallShieldArchiveV3();
var extractable = new InstallShieldArchiveV3(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.IO;
using BinaryObjectScanner.FileType;
using Xunit;
@@ -7,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class InstallShieldCABTests
{
private static readonly SabreTools.Serialization.Wrappers.InstallShieldCabinet wrapper
= new(new SabreTools.Models.InstallShieldCabinet.Cabinet(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new InstallShieldCAB();
var extractable = new InstallShieldCAB(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -24,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new InstallShieldCAB();
var extractable = new InstallShieldCAB(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -36,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new InstallShieldCAB();
var extractable = new InstallShieldCAB(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class LZKWAJTests
{
private static readonly SabreTools.Serialization.Wrappers.LZKWAJ wrapper
= new(new SabreTools.Models.LZ.KWAJFile(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZKWAJ();
var extractable = new LZKWAJ(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZKWAJ();
var extractable = new LZKWAJ(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZKWAJ();
var extractable = new LZKWAJ(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class LZQBasicTests
{
private static readonly SabreTools.Serialization.Wrappers.LZQBasic wrapper
= new(new SabreTools.Models.LZ.QBasicFile(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZQBasic();
var extractable = new LZQBasic(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZQBasic();
var extractable = new LZQBasic(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZQBasic();
var extractable = new LZQBasic(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class LZSZDDTests
{
private static readonly SabreTools.Serialization.Wrappers.LZSZDD wrapper
= new(new SabreTools.Models.LZ.SZDDFile(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZSZDD();
var extractable = new LZSZDD(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZSZDD();
var extractable = new LZSZDD(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new LZSZDD();
var extractable = new LZSZDD(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class MPQTests
{
private static readonly SabreTools.Serialization.Wrappers.MoPaQ wrapper
= new(new SabreTools.Models.MoPaQ.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new MPQ();
var extractable = new MPQ(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new MPQ();
var extractable = new MPQ(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new MPQ();
var extractable = new MPQ(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class MicrosoftCABTests
{
private static readonly SabreTools.Serialization.Wrappers.MicrosoftCabinet wrapper
= new(new SabreTools.Models.MicrosoftCabinet.Cabinet(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new MicrosoftCAB();
var extractable = new MicrosoftCAB(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new MicrosoftCAB();
var extractable = new MicrosoftCAB(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new MicrosoftCAB();
var extractable = new MicrosoftCAB(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class PAKTests
{
private static readonly SabreTools.Serialization.Wrappers.PAK wrapper
= new(new SabreTools.Models.PAK.File(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PAK();
var extractable = new PAK(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PAK();
var extractable = new PAK(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PAK();
var extractable = new PAK(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class PFFTests
{
private static readonly SabreTools.Serialization.Wrappers.PFF wrapper
= new(new SabreTools.Models.PFF.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PFF();
var extractable = new PFF(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PFF();
var extractable = new PFF(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PFF();
var extractable = new PFF(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class PKZIPTests
{
private static readonly SabreTools.Serialization.Wrappers.PKZIP wrapper
= new(new SabreTools.Models.PKZIP.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PKZIP();
var extractable = new PKZIP(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PKZIP();
var extractable = new PKZIP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new PKZIP();
var extractable = new PKZIP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class QuantumTests
{
private static readonly SabreTools.Serialization.Wrappers.Quantum wrapper
= new(new SabreTools.Models.Quantum.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new Quantum();
var extractable = new Quantum(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new Quantum();
var extractable = new Quantum(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new Quantum();
var extractable = new Quantum(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class RARTests
{
private static readonly SabreTools.Serialization.Wrappers.RAR wrapper
= new(new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new RAR();
var extractable = new RAR(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new RAR();
var extractable = new RAR(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new RAR();
var extractable = new RAR(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class SGATests
{
private static readonly SabreTools.Serialization.Wrappers.SGA wrapper
= new(new SabreTools.Models.SGA.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new SGA();
var extractable = new SGA(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new SGA();
var extractable = new SGA(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new SGA();
var extractable = new SGA(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class SevenZipTests
{
private static readonly SabreTools.Serialization.Wrappers.SevenZip wrapper
= new(new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new SevenZip();
var extractable = new SevenZip(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new SevenZip();
var extractable = new SevenZip(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new SevenZip();
var extractable = new SevenZip(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class TapeArchiveTests
{
private static readonly SabreTools.Serialization.Wrappers.TapeArchive wrapper
= new(new SabreTools.Models.TAR.Archive(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new TapeArchive();
var extractable = new TapeArchive(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new TapeArchive();
var extractable = new TapeArchive(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new TapeArchive();
var extractable = new TapeArchive(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class VBSPTests
{
private static readonly SabreTools.Serialization.Wrappers.VBSP wrapper
= new(new SabreTools.Models.BSP.VbspFile(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new VBSP();
var extractable = new VBSP(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new VBSP();
var extractable = new VBSP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new VBSP();
var extractable = new VBSP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class VPKTests
{
private static readonly SabreTools.Serialization.Wrappers.VPK wrapper
= new(new SabreTools.Models.VPK.File(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new VPK();
var extractable = new VPK(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new VPK();
var extractable = new VPK(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new VPK();
var extractable = new VPK(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class WAD3Tests
{
private static readonly SabreTools.Serialization.Wrappers.WAD3 wrapper
= new(new SabreTools.Models.WAD3.File(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new WAD3();
var extractable = new WAD3(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new WAD3();
var extractable = new WAD3(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new WAD3();
var extractable = new WAD3(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class XZPTests
{
private static readonly SabreTools.Serialization.Wrappers.XZP wrapper
= new(new SabreTools.Models.XZP.File(), new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new XZP();
var extractable = new XZP(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new XZP();
var extractable = new XZP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new XZP();
var extractable = new XZP(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -6,12 +6,15 @@ namespace BinaryObjectScanner.Test.FileType
{
public class XZTests
{
private static readonly SabreTools.Serialization.Wrappers.XZ wrapper
= new(new MemoryStream());
[Fact]
public void ExtractFile_EmptyString_False()
{
string file = string.Empty;
string outDir = string.Empty;
var extractable = new XZ();
var extractable = new XZ(wrapper);
bool actual = extractable.Extract(file, outDir, includeDebug: false);
Assert.False(actual);
@@ -23,7 +26,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = null;
string file = string.Empty;
string outDir = string.Empty;
var extractable = new XZ();
var extractable = new XZ(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);
@@ -35,7 +38,7 @@ namespace BinaryObjectScanner.Test.FileType
Stream? stream = new MemoryStream();
string file = string.Empty;
string outDir = string.Empty;
var extractable = new XZ();
var extractable = new XZ(wrapper);
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
Assert.False(actual);

View File

@@ -58,81 +58,50 @@ namespace BinaryObjectScanner
// Use the wrapper before the type
switch (wrapper)
{
case BFPK: return new FileType.BFPK();
case BSP: return new FileType.BSP();
case BZip2: return new FileType.BZip2();
case CFB: return new FileType.CFB();
case BFPK obj: return new FileType.BFPK(obj);
case BSP obj: return new FileType.BSP(obj);
case BZip2 obj: return new FileType.BZip2(obj);
case CFB obj: return new FileType.CFB(obj);
// case CIA => new FileType.CIA(),
case GCF: return new FileType.GCF();
case GZip: return new FileType.GZip();
case InstallShieldArchiveV3: return new FileType.InstallShieldArchiveV3();
case InstallShieldCabinet: return new FileType.InstallShieldCAB();
case LZKWAJ: return new FileType.LZKWAJ();
case LZQBasic: return new FileType.LZQBasic();
case LZSZDD: return new FileType.LZSZDD();
case MicrosoftCabinet: return new FileType.MicrosoftCAB();
case MoPaQ: return new FileType.MPQ();
case GCF obj: return new FileType.GCF(obj);
case GZip obj: return new FileType.GZip(obj);
case InstallShieldArchiveV3 obj: return new FileType.InstallShieldArchiveV3(obj);
case InstallShieldCabinet obj: return new FileType.InstallShieldCAB(obj);
case LZKWAJ obj: return new FileType.LZKWAJ(obj);
case LZQBasic obj: return new FileType.LZQBasic(obj);
case LZSZDD obj: return new FileType.LZSZDD(obj);
case MicrosoftCabinet obj: return new FileType.MicrosoftCAB(obj);
case MoPaQ obj: return new FileType.MPQ(obj);
// case N3DS: return new FileType.N3DS();
// case NCF: return new FileType.NCF();
case NewExecutable obj: return new FileType.NewExecutable(obj);
// case Nitro: return new FileType.Nitro();
case PAK: return new FileType.PAK();
case PFF: return new FileType.PFF();
case PKZIP: return new FileType.PKZIP();
case PAK obj: return new FileType.PAK(obj);
case PFF obj: return new FileType.PFF(obj);
case PKZIP obj: return new FileType.PKZIP(obj);
// case PlayJAudioFile: return new FileType.PLJ();
case PortableExecutable obj: return new FileType.PortableExecutable(obj);
case Quantum: return new FileType.Quantum();
case RAR: return new FileType.RAR();
case SevenZip: return new FileType.SevenZip();
case SGA: return new FileType.SGA();
case TapeArchive: return new FileType.TapeArchive();
case VBSP: return new FileType.VBSP();
case VPK: return new FileType.VPK();
case WAD3: return new FileType.WAD3();
case XZ: return new FileType.XZ();
case XZP: return new FileType.XZP();
case Quantum obj: return new FileType.Quantum(obj);
case RAR obj: return new FileType.RAR(obj);
case SevenZip obj: return new FileType.SevenZip(obj);
case SGA obj: return new FileType.SGA(obj);
case TapeArchive obj: return new FileType.TapeArchive(obj);
case VBSP obj: return new FileType.VBSP(obj);
case VPK obj: return new FileType.VPK(obj);
case WAD3 obj: return new FileType.WAD3(obj);
case XZ obj: return new FileType.XZ(obj);
case XZP obj: return new FileType.XZP(obj);
}
// Fall back on the file type for types not implemented in Serialization
return fileType switch
{
WrapperType.BFPK => new FileType.BFPK(),
WrapperType.BSP => new FileType.BSP(),
WrapperType.BZip2 => new FileType.BZip2(),
WrapperType.CFB => new FileType.CFB(),
// WrapperType.CIA => new FileType.CIA(),
// WrapperType.Executable => new FileType.Executable(),
WrapperType.GCF => new FileType.GCF(),
WrapperType.GZip => new FileType.GZip(),
WrapperType.InstallShieldArchiveV3 => new FileType.InstallShieldArchiveV3(),
WrapperType.InstallShieldCAB => new FileType.InstallShieldCAB(),
// WrapperType.LinearExecutable => new FileType.LinearExecutable(),
WrapperType.LZKWAJ => new FileType.LZKWAJ(),
WrapperType.LZQBasic => new FileType.LZQBasic(),
WrapperType.LZSZDD => new FileType.LZSZDD(),
WrapperType.MicrosoftCAB => new FileType.MicrosoftCAB(),
WrapperType.MoPaQ => new FileType.MPQ(),
// WrapperType.MSDOS => new FileType.MSDOS(),
// WrapperType.N3DS => new FileType.N3DS(),
// WrapperType.NCF => new FileType.NCF(),
// WrapperType.NewExecutable => new FileType.NewExecutable(),
// WrapperType.Nitro => new FileType.Nitro(),
WrapperType.PAK => new FileType.PAK(),
WrapperType.PFF => new FileType.PFF(),
WrapperType.PKZIP => new FileType.PKZIP(),
// WrapperType.PlayJAudioFile => new FileType.PLJ(),
// WrapperType.PortableExecutable => new FileType.PortableExecutable(),
// WrapperType.Quantum => new FileType.Quantum(),
WrapperType.RAR => new FileType.RAR(),
WrapperType.SevenZip => new FileType.SevenZip(),
WrapperType.SFFS => new FileType.SFFS(),
WrapperType.SGA => new FileType.SGA(),
WrapperType.TapeArchive => new FileType.TapeArchive(),
WrapperType.VBSP => new FileType.VBSP(),
WrapperType.VPK => new FileType.VPK(),
WrapperType.WAD => new FileType.WAD3(),
WrapperType.XZ => new FileType.XZ(),
WrapperType.XZP => new FileType.XZP(),
_ => null,
};
}

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// BFPK custom archive format
/// </summary>
public class BFPK : IExtractable<SabreTools.Serialization.Wrappers.BFPK>
public class BFPK : ExtractableBase<SabreTools.Serialization.Wrappers.BFPK>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public BFPK(SabreTools.Serialization.Wrappers.BFPK? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var bfpk = SabreTools.Serialization.Wrappers.BFPK.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Half-Life Level
/// </summary>
public class BSP : IExtractable<SabreTools.Serialization.Wrappers.BSP>
public class BSP : ExtractableBase<SabreTools.Serialization.Wrappers.BSP>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public BSP(SabreTools.Serialization.Wrappers.BSP? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var bsp = SabreTools.Serialization.Wrappers.BSP.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// bzip2 archive
/// </summary>
public class BZip2 : IExtractable<SabreTools.Serialization.Wrappers.BZip2>
public class BZip2 : ExtractableBase<SabreTools.Serialization.Wrappers.BZip2>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public BZip2(SabreTools.Serialization.Wrappers.BZip2? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Compound File Binary
/// </summary>
public class CFB : IExtractable<SabreTools.Serialization.Wrappers.CFB>
public class CFB : ExtractableBase<SabreTools.Serialization.Wrappers.CFB>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public CFB(SabreTools.Serialization.Wrappers.CFB? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var cfb = SabreTools.Serialization.Wrappers.CFB.Create(stream);

View File

@@ -0,0 +1,34 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Base class for all standard extractable types
/// </summary>
public abstract class ExtractableBase : IExtractable
{
#region Constructors
public ExtractableBase() { }
#endregion
#region IExtractable Implementations
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
/// <inheritdoc/>
public abstract bool Extract(Stream? stream, string file, string outDir, bool includeDebug);
#endregion
}
}

View File

@@ -0,0 +1,33 @@
using System;
using BinaryObjectScanner.Interfaces;
using SabreTools.Serialization.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Base class for all standard extractable types with a wrapper
/// </summary>
public abstract class ExtractableBase<T> : ExtractableBase, IExtractable<T> where T : IWrapper
{
#region Protected Instance Variables
/// <summary>
/// Wrapper representing the extractable
/// </summary>
protected T _wrapper { get; private set; }
#endregion
#region Constructors
public ExtractableBase(T? wrapper)
{
if (wrapper == null)
throw new ArgumentNullException(nameof(wrapper));
_wrapper = wrapper;
}
#endregion
}
}

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Half-Life Game Cache File
/// </summary>
public class GCF : IExtractable<SabreTools.Serialization.Wrappers.GCF>
public class GCF : ExtractableBase<SabreTools.Serialization.Wrappers.GCF>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public GCF(SabreTools.Serialization.Wrappers.GCF? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var gcf = SabreTools.Serialization.Wrappers.GCF.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// gzip archive
/// </summary>
public class GZip : IExtractable<SabreTools.Serialization.Wrappers.GZip>
public class GZip : ExtractableBase<SabreTools.Serialization.Wrappers.GZip>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public GZip(SabreTools.Serialization.Wrappers.GZip? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var gcf = SabreTools.Serialization.Wrappers.GZip.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// InstallShield archive v3
/// </summary>
public class InstallShieldArchiveV3 : IExtractable<SabreTools.Serialization.Wrappers.InstallShieldArchiveV3>
public class InstallShieldArchiveV3 : ExtractableBase<SabreTools.Serialization.Wrappers.InstallShieldArchiveV3>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public InstallShieldArchiveV3(SabreTools.Serialization.Wrappers.InstallShieldArchiveV3? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var isv3 = SabreTools.Serialization.Wrappers.InstallShieldArchiveV3.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// InstallShield cabinet file
/// </summary>
public class InstallShieldCAB : IExtractable<SabreTools.Serialization.Wrappers.InstallShieldCabinet>
public class InstallShieldCAB : ExtractableBase<SabreTools.Serialization.Wrappers.InstallShieldCabinet>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public InstallShieldCAB(SabreTools.Serialization.Wrappers.InstallShieldCabinet? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var iscab = SabreTools.Serialization.Wrappers.InstallShieldCabinet.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// LZ-compressed file, KWAJ variant
/// </summary>
public class LZKWAJ : IExtractable<SabreTools.Serialization.Wrappers.LZKWAJ>
public class LZKWAJ : ExtractableBase<SabreTools.Serialization.Wrappers.LZKWAJ>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public LZKWAJ(SabreTools.Serialization.Wrappers.LZKWAJ? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var kwaj = SabreTools.Serialization.Wrappers.LZKWAJ.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// LZ-compressed file, QBasic variant
/// </summary>
public class LZQBasic : IExtractable<SabreTools.Serialization.Wrappers.LZQBasic>
public class LZQBasic : ExtractableBase<SabreTools.Serialization.Wrappers.LZQBasic>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public LZQBasic(SabreTools.Serialization.Wrappers.LZQBasic? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var qbasic = SabreTools.Serialization.Wrappers.LZQBasic.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// LZ-compressed file, SZDD variant
/// </summary>
public class LZSZDD : IExtractable<SabreTools.Serialization.Wrappers.LZSZDD>
public class LZSZDD : ExtractableBase<SabreTools.Serialization.Wrappers.LZSZDD>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public LZSZDD(SabreTools.Serialization.Wrappers.LZSZDD? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var szdd = SabreTools.Serialization.Wrappers.LZSZDD.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// MoPaQ game data archive
/// </summary>
public class MPQ : IExtractable<SabreTools.Serialization.Wrappers.MoPaQ>
public class MPQ : ExtractableBase<SabreTools.Serialization.Wrappers.MoPaQ>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public MPQ(SabreTools.Serialization.Wrappers.MoPaQ? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var mpq = SabreTools.Serialization.Wrappers.MoPaQ.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Microsoft cabinet file
/// </summary>
public class MicrosoftCAB : IExtractable<SabreTools.Serialization.Wrappers.MicrosoftCabinet>
public class MicrosoftCAB : ExtractableBase<SabreTools.Serialization.Wrappers.MicrosoftCabinet>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public MicrosoftCAB(SabreTools.Serialization.Wrappers.MicrosoftCabinet? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var mscab = SabreTools.Serialization.Wrappers.MicrosoftCabinet.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Half-Life Package File
/// </summary>
public class PAK : IExtractable<SabreTools.Serialization.Wrappers.PAK>
public class PAK : ExtractableBase<SabreTools.Serialization.Wrappers.PAK>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public PAK(SabreTools.Serialization.Wrappers.PAK? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var pak = SabreTools.Serialization.Wrappers.PAK.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// NovaLogic Game Archive Format
/// </summary>
public class PFF : IExtractable<SabreTools.Serialization.Wrappers.PFF>
public class PFF : ExtractableBase<SabreTools.Serialization.Wrappers.PFF>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public PFF(SabreTools.Serialization.Wrappers.PFF? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var pff = SabreTools.Serialization.Wrappers.PFF.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// PKWARE ZIP archive and derivatives
/// </summary>
public class PKZIP : IExtractable<SabreTools.Serialization.Wrappers.PKZIP>
public class PKZIP : ExtractableBase<SabreTools.Serialization.Wrappers.PKZIP>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public PKZIP(SabreTools.Serialization.Wrappers.PKZIP? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var pkzip = SabreTools.Serialization.Wrappers.PKZIP.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Quantum Archive
/// </summary>
public class Quantum : IExtractable<SabreTools.Serialization.Wrappers.Quantum>
public class Quantum : ExtractableBase<SabreTools.Serialization.Wrappers.Quantum>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public Quantum(SabreTools.Serialization.Wrappers.Quantum? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var qtm = SabreTools.Serialization.Wrappers.Quantum.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// RAR archive
/// </summary>
public class RAR : IExtractable<SabreTools.Serialization.Wrappers.RAR>
public class RAR : ExtractableBase<SabreTools.Serialization.Wrappers.RAR>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public RAR(SabreTools.Serialization.Wrappers.RAR? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// SGA game archive
/// </summary>
public class SGA : IExtractable<SabreTools.Serialization.Wrappers.SGA>
public class SGA : ExtractableBase<SabreTools.Serialization.Wrappers.SGA>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public SGA(SabreTools.Serialization.Wrappers.SGA? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var sga = SabreTools.Serialization.Wrappers.SGA.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// 7-zip archive
/// </summary>
public class SevenZip : IExtractable<SabreTools.Serialization.Wrappers.SevenZip>
public class SevenZip : ExtractableBase<SabreTools.Serialization.Wrappers.SevenZip>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public SevenZip(SabreTools.Serialization.Wrappers.SevenZip? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Tape archive
/// </summary>
public class TapeArchive : IExtractable<SabreTools.Serialization.Wrappers.TapeArchive>
public class TapeArchive : ExtractableBase<SabreTools.Serialization.Wrappers.TapeArchive>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public TapeArchive(SabreTools.Serialization.Wrappers.TapeArchive? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var tar = SabreTools.Serialization.Wrappers.TapeArchive.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Half-Life 2 Level
/// </summary>
public class VBSP : IExtractable<SabreTools.Serialization.Wrappers.VBSP>
public class VBSP : ExtractableBase<SabreTools.Serialization.Wrappers.VBSP>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public VBSP(SabreTools.Serialization.Wrappers.VBSP? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var vbsp = SabreTools.Serialization.Wrappers.VBSP.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Valve Package File
/// </summary>
public class VPK : IExtractable<SabreTools.Serialization.Wrappers.VPK>
public class VPK : ExtractableBase<SabreTools.Serialization.Wrappers.VPK>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public VPK(SabreTools.Serialization.Wrappers.VPK? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var vpk = SabreTools.Serialization.Wrappers.VPK.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Half-Life Texture Package File
/// </summary>
public class WAD3 : IExtractable<SabreTools.Serialization.Wrappers.WAD3>
public class WAD3 : ExtractableBase<SabreTools.Serialization.Wrappers.WAD3>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public WAD3(SabreTools.Serialization.Wrappers.WAD3? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var wad = SabreTools.Serialization.Wrappers.WAD3.Create(stream);

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// xz archive
/// </summary>
public class XZ : IExtractable<SabreTools.Serialization.Wrappers.XZ>
public class XZ : ExtractableBase<SabreTools.Serialization.Wrappers.XZ>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public XZ(SabreTools.Serialization.Wrappers.XZ? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Handle invalid inputs
if (stream == null || stream.Length == 0)

View File

@@ -1,25 +1,17 @@
using System.IO;
using BinaryObjectScanner.Interfaces;
namespace BinaryObjectScanner.FileType
{
/// <summary>
/// XBox Package File
/// </summary>
public class XZP : IExtractable<SabreTools.Serialization.Wrappers.XZP>
public class XZP : ExtractableBase<SabreTools.Serialization.Wrappers.XZP>
{
/// <inheritdoc/>
public bool Extract(string file, string outDir, bool includeDebug)
{
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
public XZP(SabreTools.Serialization.Wrappers.XZP? wrapper) : base(wrapper) { }
/// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
{
// Create the wrapper
var xzp = SabreTools.Serialization.Wrappers.XZP.Create(stream);