mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-04 05:35:49 +00:00
Use extractable wrappers where appropriate
This commit is contained in:
@@ -53,72 +53,5 @@ namespace BinaryObjectScanner.Test
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateExtractable
|
||||
|
||||
private static readonly List<WrapperType> _extractableTypes =
|
||||
[
|
||||
// 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, // 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]
|
||||
[MemberData(nameof(GenerateIExtractableTestData))]
|
||||
public void CreateExtractableTests(WrapperType type, bool expectNull)
|
||||
{
|
||||
IExtractable? actual = Factory.CreateExtractable(type);
|
||||
|
||||
if (expectNull)
|
||||
Assert.Null(actual);
|
||||
else
|
||||
Assert.NotNull(actual);
|
||||
}
|
||||
|
||||
public static List<object?[]> GenerateIExtractableTestData()
|
||||
{
|
||||
var testData = new List<object?[]>();
|
||||
foreach (WrapperType type in Enum.GetValues(typeof(WrapperType)))
|
||||
{
|
||||
if (_extractableTypes.Contains(type))
|
||||
testData.Add([type, false]);
|
||||
else
|
||||
testData.Add([type, true]);
|
||||
}
|
||||
|
||||
return testData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new BFPK(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new BFPK(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new BSP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new BSP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new BZip2(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new BZip2(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new CFB(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new CFB(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new GCF(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new GCF(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new GZip(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new GZip(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new InstallShieldArchiveV3(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new InstallShieldArchiveV3(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new InstallShieldCAB(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new InstallShieldCAB(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new LZKWAJ(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new LZKWAJ(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new LZQBasic(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new LZQBasic(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new LZSZDD(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new LZSZDD(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new MPQ(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new MPQ(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new MicrosoftCAB(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new MicrosoftCAB(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new PAK(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new PAK(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new PFF(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new PFF(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new PKZIP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new PKZIP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new Quantum(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new Quantum(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new RAR(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new RAR(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,40 +26,5 @@ namespace BinaryObjectScanner.Test.FileType
|
||||
string? actual = detectable.Detect(stream, file, includeDebug: false);
|
||||
Assert.Null(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractFile_EmptyString_False()
|
||||
{
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SFFS();
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SFFS();
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SFFS();
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SGA(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SGA(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SevenZip(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new SevenZip(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new TapeArchive(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new TapeArchive(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new VBSP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new VBSP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new VPK(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new VPK(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new WAD3(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new WAD3(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new XZP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new XZP(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using Xunit;
|
||||
|
||||
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(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Null_False()
|
||||
{
|
||||
Stream? stream = null;
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new XZ(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractStream_Empty_False()
|
||||
{
|
||||
Stream? stream = new MemoryStream();
|
||||
string file = string.Empty;
|
||||
string outDir = string.Empty;
|
||||
var extractable = new XZ(wrapper);
|
||||
|
||||
bool actual = extractable.Extract(stream, file, outDir, includeDebug: false);
|
||||
Assert.False(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,67 +43,5 @@ namespace BinaryObjectScanner
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of an extractable based on file type
|
||||
/// </summary>
|
||||
public static Interfaces.IExtractable? CreateExtractable(WrapperType fileType)
|
||||
=> CreateExtractable(fileType, null);
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of an extractable based on file type
|
||||
/// </summary>
|
||||
public static Interfaces.IExtractable? CreateExtractable(WrapperType fileType, IWrapper? wrapper)
|
||||
{
|
||||
// Use the wrapper before the type
|
||||
switch (wrapper)
|
||||
{
|
||||
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 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 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 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.CIA => new FileType.CIA(),
|
||||
// WrapperType.N3DS => new FileType.N3DS(),
|
||||
// WrapperType.NCF => new FileType.NCF(),
|
||||
// WrapperType.Nitro => new FileType.Nitro(),
|
||||
// WrapperType.PlayJAudioFile => new FileType.PLJ(),
|
||||
WrapperType.SFFS => new FileType.SFFS(),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// BFPK custom archive format
|
||||
/// </summary>
|
||||
public class BFPK : ExtractableBase<SabreTools.Serialization.Wrappers.BFPK>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public BFPK(SabreTools.Serialization.Wrappers.BFPK? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Half-Life Level
|
||||
/// </summary>
|
||||
public class BSP : ExtractableBase<SabreTools.Serialization.Wrappers.BSP>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public BSP(SabreTools.Serialization.Wrappers.BSP? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// bzip2 archive
|
||||
/// </summary>
|
||||
public class BZip2 : ExtractableBase<SabreTools.Serialization.Wrappers.BZip2>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public BZip2(SabreTools.Serialization.Wrappers.BZip2? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Compound File Binary
|
||||
/// </summary>
|
||||
public class CFB : ExtractableBase<SabreTools.Serialization.Wrappers.CFB>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public CFB(SabreTools.Serialization.Wrappers.CFB? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all standard detectable/extractable types
|
||||
/// </summary>
|
||||
public abstract class DetectableExtractableBase : IDetectable, IExtractable
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public DetectableExtractableBase() { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDetectable Implementations
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
|
||||
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
return Detect(fs, file, includeDebug);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public abstract string? Detect(Stream stream, string file, bool includeDebug);
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all standard detectable/extractable types with a wrapper
|
||||
/// </summary>
|
||||
public abstract class DetectableExtractableBase<T> : DetectableExtractableBase, IDetectable<T>, IExtractable<T>
|
||||
where T : IWrapper
|
||||
{
|
||||
#region Protected Instance Variables
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper representing the detectable/extractable
|
||||
/// </summary>
|
||||
protected T _wrapper { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public DetectableExtractableBase(T? wrapper)
|
||||
{
|
||||
if (wrapper == null)
|
||||
throw new ArgumentNullException(nameof(wrapper));
|
||||
|
||||
_wrapper = wrapper;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ namespace BinaryObjectScanner.FileType
|
||||
/// <summary>
|
||||
/// Executable or library
|
||||
/// </summary>
|
||||
public abstract class Executable<T> : DetectableExtractableBase<T>
|
||||
public abstract class Executable<T> : DetectableBase<T>
|
||||
where T : WrapperBase
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Half-Life Game Cache File
|
||||
/// </summary>
|
||||
public class GCF : ExtractableBase<SabreTools.Serialization.Wrappers.GCF>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public GCF(SabreTools.Serialization.Wrappers.GCF? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// gzip archive
|
||||
/// </summary>
|
||||
public class GZip : ExtractableBase<SabreTools.Serialization.Wrappers.GZip>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public GZip(SabreTools.Serialization.Wrappers.GZip? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// InstallShield archive v3
|
||||
/// </summary>
|
||||
public class InstallShieldArchiveV3 : ExtractableBase<SabreTools.Serialization.Wrappers.InstallShieldArchiveV3>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public InstallShieldArchiveV3(SabreTools.Serialization.Wrappers.InstallShieldArchiveV3? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// InstallShield cabinet file
|
||||
/// </summary>
|
||||
public class InstallShieldCAB : ExtractableBase<SabreTools.Serialization.Wrappers.InstallShieldCabinet>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public InstallShieldCAB(SabreTools.Serialization.Wrappers.InstallShieldCabinet? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// LZ-compressed file, KWAJ variant
|
||||
/// </summary>
|
||||
public class LZKWAJ : ExtractableBase<SabreTools.Serialization.Wrappers.LZKWAJ>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public LZKWAJ(SabreTools.Serialization.Wrappers.LZKWAJ? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// LZ-compressed file, QBasic variant
|
||||
/// </summary>
|
||||
public class LZQBasic : ExtractableBase<SabreTools.Serialization.Wrappers.LZQBasic>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public LZQBasic(SabreTools.Serialization.Wrappers.LZQBasic? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// LZ-compressed file, SZDD variant
|
||||
/// </summary>
|
||||
public class LZSZDD : ExtractableBase<SabreTools.Serialization.Wrappers.LZSZDD>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public LZSZDD(SabreTools.Serialization.Wrappers.LZSZDD? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,5 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
return string.Join(";", [.. protectionList]);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug) => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// MoPaQ game data archive
|
||||
/// </summary>
|
||||
public class MPQ : ExtractableBase<SabreTools.Serialization.Wrappers.MoPaQ>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public MPQ(SabreTools.Serialization.Wrappers.MoPaQ? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,5 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
return string.Join(";", [.. protectionList]);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug) => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Microsoft cabinet file
|
||||
/// </summary>
|
||||
public class MicrosoftCAB : ExtractableBase<SabreTools.Serialization.Wrappers.MicrosoftCabinet>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public MicrosoftCAB(SabreTools.Serialization.Wrappers.MicrosoftCabinet? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,22 +43,5 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
return string.Join(";", [.. protectionList]);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
// Create the output directory
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
// Extract all files
|
||||
bool extractAny = false;
|
||||
if (new Packer.EmbeddedFile().CheckExecutable(file, _wrapper, includeDebug) != null)
|
||||
extractAny |= _wrapper.ExtractFromOverlay(outDir, includeDebug);
|
||||
|
||||
if (new Packer.WiseInstaller().CheckExecutable(file, _wrapper, includeDebug) != null)
|
||||
extractAny |= _wrapper.ExtractWise(outDir, includeDebug);
|
||||
|
||||
return extractAny;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Half-Life Package File
|
||||
/// </summary>
|
||||
public class PAK : ExtractableBase<SabreTools.Serialization.Wrappers.PAK>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PAK(SabreTools.Serialization.Wrappers.PAK? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// NovaLogic Game Archive Format
|
||||
/// </summary>
|
||||
public class PFF : ExtractableBase<SabreTools.Serialization.Wrappers.PFF>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PFF(SabreTools.Serialization.Wrappers.PFF? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// PKWARE ZIP archive and derivatives
|
||||
/// </summary>
|
||||
public class PKZIP : ExtractableBase<SabreTools.Serialization.Wrappers.PKZIP>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public PKZIP(SabreTools.Serialization.Wrappers.PKZIP? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,28 +43,5 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
return string.Join(";", [.. protectionList]);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
// Create the output directory
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
// Extract all files
|
||||
bool extractAny = false;
|
||||
if (new Packer.CExe().CheckExecutable(file, _wrapper, includeDebug) != null)
|
||||
extractAny |= _wrapper.ExtractCExe(outDir, includeDebug);
|
||||
|
||||
if (new Packer.EmbeddedFile().CheckExecutable(file, _wrapper, includeDebug) != null)
|
||||
{
|
||||
extractAny |= _wrapper.ExtractFromOverlay(outDir, includeDebug);
|
||||
extractAny |= _wrapper.ExtractFromResources(outDir, includeDebug);
|
||||
}
|
||||
|
||||
if (new Packer.WiseInstaller().CheckExecutable(file, _wrapper, includeDebug) != null)
|
||||
extractAny |= _wrapper.ExtractWise(outDir, includeDebug);
|
||||
|
||||
return extractAny;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Quantum Archive
|
||||
/// </summary>
|
||||
public class Quantum : ExtractableBase<SabreTools.Serialization.Wrappers.Quantum>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Quantum(SabreTools.Serialization.Wrappers.Quantum? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// RAR archive
|
||||
/// </summary>
|
||||
public class RAR : ExtractableBase<SabreTools.Serialization.Wrappers.RAR>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public RAR(SabreTools.Serialization.Wrappers.RAR? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,8 @@ namespace BinaryObjectScanner.FileType
|
||||
/// StarForce Filesystem file
|
||||
/// </summary>
|
||||
/// <see href="https://forum.xentax.com/viewtopic.php?f=21&t=2084"/>
|
||||
public class SFFS : DetectableExtractableBase
|
||||
/// TODO: Implement extraction
|
||||
public class SFFS : DetectableBase
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override string? Detect(Stream stream, string file, bool includeDebug)
|
||||
@@ -28,11 +29,5 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// SGA game archive
|
||||
/// </summary>
|
||||
public class SGA : ExtractableBase<SabreTools.Serialization.Wrappers.SGA>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public SGA(SabreTools.Serialization.Wrappers.SGA? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// 7-zip archive
|
||||
/// </summary>
|
||||
public class SevenZip : ExtractableBase<SabreTools.Serialization.Wrappers.SevenZip>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public SevenZip(SabreTools.Serialization.Wrappers.SevenZip? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Tape archive
|
||||
/// </summary>
|
||||
public class TapeArchive : ExtractableBase<SabreTools.Serialization.Wrappers.TapeArchive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public TapeArchive(SabreTools.Serialization.Wrappers.TapeArchive? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Half-Life 2 Level
|
||||
/// </summary>
|
||||
public class VBSP : ExtractableBase<SabreTools.Serialization.Wrappers.VBSP>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public VBSP(SabreTools.Serialization.Wrappers.VBSP? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Valve Package File
|
||||
/// </summary>
|
||||
public class VPK : ExtractableBase<SabreTools.Serialization.Wrappers.VPK>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public VPK(SabreTools.Serialization.Wrappers.VPK? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// Half-Life Texture Package File
|
||||
/// </summary>
|
||||
public class WAD3 : ExtractableBase<SabreTools.Serialization.Wrappers.WAD3>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public WAD3(SabreTools.Serialization.Wrappers.WAD3? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// xz archive
|
||||
/// </summary>
|
||||
public class XZ : ExtractableBase<SabreTools.Serialization.Wrappers.XZ>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public XZ(SabreTools.Serialization.Wrappers.XZ? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Package File
|
||||
/// </summary>
|
||||
public class XZP : ExtractableBase<SabreTools.Serialization.Wrappers.XZP>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public XZP(SabreTools.Serialization.Wrappers.XZP? wrapper) : base(wrapper) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Extract(Stream? stream, string file, string outDir, bool includeDebug)
|
||||
{
|
||||
Directory.CreateDirectory(outDir);
|
||||
return _wrapper.Extract(outDir, includeDebug);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,18 +286,16 @@ namespace BinaryObjectScanner
|
||||
|
||||
#region Archive File Types
|
||||
|
||||
// Create an extractable for the given file type
|
||||
var extractable = Factory.CreateExtractable(fileType, wrapper);
|
||||
|
||||
// If we're scanning archives
|
||||
if (extractable != null && _options.ScanArchives)
|
||||
if (wrapper is SabreTools.Serialization.Interfaces.IExtractable extractable && _options.ScanArchives)
|
||||
{
|
||||
// If the extractable file itself fails
|
||||
try
|
||||
{
|
||||
// Extract and get the output path
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
bool extracted = extractable.Extract(stream, fileName, tempPath, _options.IncludeDebug);
|
||||
Directory.CreateDirectory(tempPath);
|
||||
bool extracted = extractable.Extract(tempPath, _options.IncludeDebug);
|
||||
|
||||
// Collect and format all found protections
|
||||
ProtectionDictionary? subProtections = null;
|
||||
|
||||
@@ -377,7 +377,7 @@ Typed checks, such as `IExecutableCheck<T>` should always follow this order: `MS
|
||||
| Project | Description |
|
||||
| --- | --- |
|
||||
| `BinaryObjectScanner` | Varies from file to file. |
|
||||
| `BinaryObjectScanner/FileType` | `IDetectable` implementations, `IExtractable` implementations, helper methods. |
|
||||
| `BinaryObjectScanner/FileType` | `IDetectable` implementations, helper methods. |
|
||||
| `BinaryObjectScanner/GameEngine` | `IContentCheck` implementations, `IExecutableCheck<T>` implementations, `IPathCheck` implementations, helper methods. |
|
||||
| `BinaryObjectScanner/Interfaces` | Methods ordered alphabetically. |
|
||||
| `BinaryObjectScanner/Packer` | `IContentCheck` implementations, `IExecutableCheck<T>` implementations, `IPathCheck` implementations, helper methods. |
|
||||
|
||||
@@ -33,7 +33,7 @@ Adding a new checker or format should happen in a few distinct steps:
|
||||
|
||||
1. Create a skeleton class representing the new checker or format
|
||||
|
||||
- If it is a new supported file type (such as an archive format), create the file in `BinaryObjectScanner.FileType`. By default, you will need to implement `BinaryObjectScanner.Interfaces.IDetectable` or `BinaryObjectScanner.Interfaces.IExtractable`. Do not implement any other interfaces. Please consider asking project maintainers before doing this work, especially if there are external dependencies.
|
||||
- If it is a new supported file type (such as an archive format), create the file in `BinaryObjectScanner.FileType`. By default, you will need to implement `BinaryObjectScanner.Interfaces.IDetectable`. Do not implement any other interfaces. Please consider asking project maintainers before doing this work, especially if there are external dependencies.
|
||||
|
||||
- If it is a new supported game engine or standard library, create the file in `BinaryObjectScanner.GameEngine`. By default, you will need to implement `BinaryObjectScanner.Interfaces.IExecutableCheck<T>`. It is exceptionally rare to need to implement `BinaryObjectScanner.Interfaces.IPathCheck`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user