mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-21 08:15:04 +00:00
Enable nullable context and move WrapperFactory
This commit is contained in:
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class AACSMediaKeyBlock : IDetectable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,22 +27,26 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// If the MKB file itself fails
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.AACSMediaKeyBlock mkb = SabreTools.Serialization.Wrappers.AACSMediaKeyBlock.Create(stream);
|
||||
var mkb = SabreTools.Serialization.Wrappers.AACSMediaKeyBlock.Create(stream);
|
||||
if (mkb == null)
|
||||
return null;
|
||||
|
||||
// Derive the version, if possible
|
||||
var typeAndVersion = mkb.Model.Records.FirstOrDefault(r => r.RecordType == SabreTools.Models.AACS.RecordType.TypeAndVersion);
|
||||
var typeAndVersion = mkb.Model.Records?.FirstOrDefault(r => r?.RecordType == SabreTools.Models.AACS.RecordType.TypeAndVersion);
|
||||
if (typeAndVersion == null)
|
||||
return "AACS (Unknown Version)";
|
||||
else
|
||||
return $"AACS {(typeAndVersion as SabreTools.Models.AACS.TypeAndVersionRecord).VersionNumber}";
|
||||
return $"AACS {(typeAndVersion as SabreTools.Models.AACS.TypeAndVersionRecord)?.VersionNumber}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class BDPlusSVM : IDetectable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -22,13 +26,17 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// If the BD+ file itself fails
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.BDPlusSVM svm = SabreTools.Serialization.Wrappers.BDPlusSVM.Create(stream);
|
||||
var svm = SabreTools.Serialization.Wrappers.BDPlusSVM.Create(stream);
|
||||
if (svm == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class BFPK : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,12 +28,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.BFPK bfpk = SabreTools.Serialization.Wrappers.BFPK.Create(stream);
|
||||
var bfpk = SabreTools.Serialization.Wrappers.BFPK.Create(stream);
|
||||
if (bfpk == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class BSP : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,12 +27,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.BSP bsp = SabreTools.Serialization.Wrappers.BSP.Create(stream);
|
||||
var bsp = SabreTools.Serialization.Wrappers.BSP.Create(stream);
|
||||
if (bsp == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class BZip2 : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -19,13 +19,16 @@
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'!='net48'">
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Compression\BinaryObjectScanner.Compression.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.GameEngine\BinaryObjectScanner.GameEngine.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Interfaces\BinaryObjectScanner.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Packer\BinaryObjectScanner.Packer.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Protection\BinaryObjectScanner.Protection.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class CFB : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -49,7 +57,14 @@ namespace BinaryObjectScanner.FileType
|
||||
if (strData == null)
|
||||
return;
|
||||
|
||||
#if NET48
|
||||
string decoded = DecodeStreamName(e.Name).TrimEnd('\0');
|
||||
#else
|
||||
string? decoded = DecodeStreamName(e.Name)?.TrimEnd('\0');
|
||||
#endif
|
||||
if (decoded == null)
|
||||
return;
|
||||
|
||||
byte[] nameBytes = Encoding.UTF8.GetBytes(e.Name);
|
||||
|
||||
// UTF-8 encoding of 0x4840.
|
||||
@@ -84,7 +99,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <remarks>Adapted from LibMSI</remarks>
|
||||
#if NET48
|
||||
public static string DecodeStreamName(string input)
|
||||
#else
|
||||
public static string? DecodeStreamName(string input)
|
||||
#endif
|
||||
{
|
||||
if (input == null)
|
||||
return null;
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using BinaryObjectScanner.Utilities;
|
||||
using BinaryObjectScanner.Wrappers;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
namespace BinaryObjectScanner.FileType
|
||||
@@ -44,7 +43,7 @@ namespace BinaryObjectScanner.FileType
|
||||
if (contentCheckClasses == null)
|
||||
contentCheckClasses = InitCheckClasses<IContentCheck>();
|
||||
|
||||
return contentCheckClasses;
|
||||
return contentCheckClasses ?? Enumerable.Empty<IContentCheck>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ namespace BinaryObjectScanner.FileType
|
||||
if (linearExecutableCheckClasses == null)
|
||||
linearExecutableCheckClasses = InitCheckClasses<ILinearExecutableCheck>();
|
||||
|
||||
return linearExecutableCheckClasses;
|
||||
return linearExecutableCheckClasses ?? Enumerable.Empty<ILinearExecutableCheck>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +71,7 @@ namespace BinaryObjectScanner.FileType
|
||||
if (msdosExecutableCheckClasses == null)
|
||||
msdosExecutableCheckClasses = InitCheckClasses<IMSDOSExecutableCheck>();
|
||||
|
||||
return msdosExecutableCheckClasses;
|
||||
return msdosExecutableCheckClasses ?? Enumerable.Empty<IMSDOSExecutableCheck>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +85,7 @@ namespace BinaryObjectScanner.FileType
|
||||
if (newExecutableCheckClasses == null)
|
||||
newExecutableCheckClasses = InitCheckClasses<INewExecutableCheck>();
|
||||
|
||||
return newExecutableCheckClasses;
|
||||
return newExecutableCheckClasses ?? Enumerable.Empty<INewExecutableCheck>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +99,7 @@ namespace BinaryObjectScanner.FileType
|
||||
if (portableExecutableCheckClasses == null)
|
||||
portableExecutableCheckClasses = InitCheckClasses<IPortableExecutableCheck>();
|
||||
|
||||
return portableExecutableCheckClasses;
|
||||
return portableExecutableCheckClasses ?? Enumerable.Empty<IPortableExecutableCheck>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,32 +110,56 @@ namespace BinaryObjectScanner.FileType
|
||||
/// <summary>
|
||||
/// Cache for all IContentCheck types
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<IContentCheck> contentCheckClasses;
|
||||
#else
|
||||
private static IEnumerable<IContentCheck>? contentCheckClasses;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Cache for all ILinearExecutableCheck types
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<ILinearExecutableCheck> linearExecutableCheckClasses;
|
||||
#else
|
||||
private static IEnumerable<ILinearExecutableCheck>? linearExecutableCheckClasses;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Cache for all IMSDOSExecutableCheck types
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<IMSDOSExecutableCheck> msdosExecutableCheckClasses;
|
||||
#else
|
||||
private static IEnumerable<IMSDOSExecutableCheck>? msdosExecutableCheckClasses;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Cache for all INewExecutableCheck types
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<INewExecutableCheck> newExecutableCheckClasses;
|
||||
#else
|
||||
private static IEnumerable<INewExecutableCheck>? newExecutableCheckClasses;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Cache for all IPortableExecutableCheck types
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<IPortableExecutableCheck> portableExecutableCheckClasses;
|
||||
#else
|
||||
private static IEnumerable<IPortableExecutableCheck>? portableExecutableCheckClasses;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -148,7 +171,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// Try to create a wrapper for the proper executable type
|
||||
var wrapper = WrapperFactory.CreateExecutableWrapper(stream);
|
||||
@@ -203,7 +230,11 @@ namespace BinaryObjectScanner.FileType
|
||||
/// <param name="stream">Stream to scan the contents of</param>
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <returns>Set of protections in file, null on error</returns>
|
||||
#if NET48
|
||||
public ConcurrentDictionary<IContentCheck, string> RunContentChecks(string file, Stream stream, bool includeDebug)
|
||||
#else
|
||||
public ConcurrentDictionary<IContentCheck, string>? RunContentChecks(string? file, Stream stream, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// If we have an invalid file
|
||||
if (string.IsNullOrWhiteSpace(file))
|
||||
@@ -212,7 +243,11 @@ namespace BinaryObjectScanner.FileType
|
||||
return null;
|
||||
|
||||
// Read the file contents
|
||||
#if NET48
|
||||
byte[] fileContent = null;
|
||||
#else
|
||||
byte[]? fileContent = null;
|
||||
#endif
|
||||
try
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(stream, Encoding.Default, true))
|
||||
@@ -396,15 +431,23 @@ namespace BinaryObjectScanner.FileType
|
||||
/// <summary>
|
||||
/// Initialize all implementations of a type
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<T> InitCheckClasses<T>()
|
||||
=> InitCheckClasses<T>(typeof(GameEngine._DUMMY).Assembly)
|
||||
.Concat(InitCheckClasses<T>(typeof(Packer._DUMMY).Assembly))
|
||||
.Concat(InitCheckClasses<T>(typeof(Protection._DUMMY).Assembly));
|
||||
#else
|
||||
private static IEnumerable<T>? InitCheckClasses<T>()
|
||||
#endif
|
||||
=> InitCheckClasses<T>(typeof(GameEngine._DUMMY).Assembly) ?? Enumerable.Empty<T>()
|
||||
.Concat(InitCheckClasses<T>(typeof(Packer._DUMMY).Assembly) ?? Enumerable.Empty<T>())
|
||||
.Concat(InitCheckClasses<T>(typeof(Protection._DUMMY).Assembly) ?? Enumerable.Empty<T>());
|
||||
|
||||
/// <summary>
|
||||
/// Initialize all implementations of a type
|
||||
/// </summary>
|
||||
#if NET48
|
||||
private static IEnumerable<T> InitCheckClasses<T>(Assembly assembly)
|
||||
#else
|
||||
private static IEnumerable<T>? InitCheckClasses<T>(Assembly assembly)
|
||||
#endif
|
||||
{
|
||||
return assembly.GetTypes()
|
||||
.Where(t => t.IsClass && t.GetInterface(typeof(T).Name) != null)
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class GCF : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,12 +27,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.GCF gcf = SabreTools.Serialization.Wrappers.GCF.Create(stream);
|
||||
var gcf = SabreTools.Serialization.Wrappers.GCF.Create(stream);
|
||||
if (gcf == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class GZIP : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class InstallShieldArchiveV3 : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -38,8 +46,13 @@ namespace BinaryObjectScanner.FileType
|
||||
try
|
||||
{
|
||||
string tempFile = Path.Combine(tempPath, cfile.FullPath);
|
||||
if (!Directory.Exists(Path.GetDirectoryName(tempFile)))
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(tempFile));
|
||||
#if NET48
|
||||
string directoryName = Path.GetDirectoryName(tempFile);
|
||||
#else
|
||||
string? directoryName = Path.GetDirectoryName(tempFile);
|
||||
#endif
|
||||
if (directoryName != null && !Directory.Exists(directoryName))
|
||||
Directory.CreateDirectory(directoryName);
|
||||
|
||||
(byte[] fileContents, string error) = archive.Extract(cfile.FullPath);
|
||||
if (!string.IsNullOrWhiteSpace(error))
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class InstallShieldCAB : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,18 +28,39 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// Get the name of the first cabinet file or header
|
||||
#if NET48
|
||||
string directory = Path.GetDirectoryName(file);
|
||||
#else
|
||||
string? directory = Path.GetDirectoryName(file);
|
||||
#endif
|
||||
string noExtension = Path.GetFileNameWithoutExtension(file);
|
||||
string filenamePattern = Path.Combine(directory, noExtension);
|
||||
filenamePattern = new Regex(@"\d+$").Replace(filenamePattern, string.Empty);
|
||||
|
||||
bool cabinetHeaderExists = File.Exists(Path.Combine(directory, filenamePattern + "1.hdr"));
|
||||
bool shouldScanCabinet = cabinetHeaderExists
|
||||
? file.Equals(Path.Combine(directory, filenamePattern + "1.hdr"), StringComparison.OrdinalIgnoreCase)
|
||||
: file.Equals(Path.Combine(directory, filenamePattern + "1.cab"), StringComparison.OrdinalIgnoreCase);
|
||||
bool shouldScanCabinet;
|
||||
if (directory == null)
|
||||
{
|
||||
string filenamePattern = noExtension;
|
||||
filenamePattern = new Regex(@"\d+$").Replace(filenamePattern, string.Empty);
|
||||
bool cabinetHeaderExists = File.Exists(filenamePattern + "1.hdr");
|
||||
shouldScanCabinet = cabinetHeaderExists
|
||||
? file.Equals(filenamePattern + "1.hdr", StringComparison.OrdinalIgnoreCase)
|
||||
: file.Equals(filenamePattern + "1.cab", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else
|
||||
{
|
||||
string filenamePattern = Path.Combine(directory, noExtension);
|
||||
filenamePattern = new Regex(@"\d+$").Replace(filenamePattern, string.Empty);
|
||||
bool cabinetHeaderExists = File.Exists(Path.Combine(directory, filenamePattern + "1.hdr"));
|
||||
shouldScanCabinet = cabinetHeaderExists
|
||||
? file.Equals(Path.Combine(directory, filenamePattern + "1.hdr"), StringComparison.OrdinalIgnoreCase)
|
||||
: file.Equals(Path.Combine(directory, filenamePattern + "1.cab"), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
// If we have anything but the first file
|
||||
if (!shouldScanCabinet)
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class LDSCRYPT : IDetectable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,7 +27,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -13,7 +13,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class MPQ : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -26,7 +30,11 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
// TODO: Add stream opening support
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
// Not supported for .NET 6.0 due to Windows DLL requirements
|
||||
|
||||
@@ -13,7 +13,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class MicrosoftCAB : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -25,7 +29,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class MicrosoftLZ : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -10,7 +10,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class PAK : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -22,12 +26,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.PAK pak = SabreTools.Serialization.Wrappers.PAK.Create(stream);
|
||||
var pak = SabreTools.Serialization.Wrappers.PAK.Create(stream);
|
||||
if (pak == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class PFF : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -22,12 +26,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.PFF pff = SabreTools.Serialization.Wrappers.PFF.Create(stream);
|
||||
var pff = SabreTools.Serialization.Wrappers.PFF.Create(stream);
|
||||
if (pff == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class PKZIP : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -43,7 +51,13 @@ namespace BinaryObjectScanner.FileType
|
||||
continue;
|
||||
|
||||
string tempFile = Path.Combine(tempPath, entry.Key);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(tempFile));
|
||||
#if NET48
|
||||
string directoryName = Path.GetDirectoryName(tempFile);
|
||||
#else
|
||||
string? directoryName = Path.GetDirectoryName(tempFile);
|
||||
#endif
|
||||
if (directoryName != null && !Directory.Exists(directoryName))
|
||||
Directory.CreateDirectory(directoryName);
|
||||
entry.WriteToFile(tempFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class PLJ : IDetectable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,7 +27,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -10,7 +10,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class Quantum : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -22,12 +26,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.Quantum quantum = SabreTools.Serialization.Wrappers.Quantum.Create(stream);
|
||||
var quantum = SabreTools.Serialization.Wrappers.Quantum.Create(stream);
|
||||
if (quantum == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class RAR : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class SFFS : IExtractable, IDetectable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -43,7 +51,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -55,7 +67,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class SGA : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -25,12 +29,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.SGA sga = SabreTools.Serialization.Wrappers.SGA.Create(stream);
|
||||
var sga = SabreTools.Serialization.Wrappers.SGA.Create(stream);
|
||||
if (sga == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class SevenZip : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class TapeArchive : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class Textfile : IDetectable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,7 +28,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Detect(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Detect(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// Files can be protected in multiple ways
|
||||
var protections = new List<string>();
|
||||
@@ -32,7 +40,11 @@ namespace BinaryObjectScanner.FileType
|
||||
try
|
||||
{
|
||||
// Load the current file content
|
||||
#if NET48
|
||||
string fileContent = null;
|
||||
#else
|
||||
string? fileContent = null;
|
||||
#endif
|
||||
using (var sr = new StreamReader(stream, Encoding.Default, true, 1024 * 1024, true))
|
||||
{
|
||||
fileContent = sr.ReadToEnd();
|
||||
|
||||
@@ -10,7 +10,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class VBSP : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -22,12 +26,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.VBSP vbsp = SabreTools.Serialization.Wrappers.VBSP.Create(stream);
|
||||
var vbsp = SabreTools.Serialization.Wrappers.VBSP.Create(stream);
|
||||
if (vbsp == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class VPK : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -24,12 +28,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.VPK vpk = SabreTools.Serialization.Wrappers.VPK.Create(stream);
|
||||
var vpk = SabreTools.Serialization.Wrappers.VPK.Create(stream);
|
||||
if (vpk == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class WAD : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -22,12 +26,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.WAD wad = SabreTools.Serialization.Wrappers.WAD.Create(stream);
|
||||
var wad = SabreTools.Serialization.Wrappers.WAD.Create(stream);
|
||||
if (wad == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class XZ : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,7 +27,11 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace BinaryObjectScanner.FileType
|
||||
public class XZP : IExtractable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -23,12 +27,16 @@ namespace BinaryObjectScanner.FileType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create the wrapper
|
||||
SabreTools.Serialization.Wrappers.XZP xzp = SabreTools.Serialization.Wrappers.XZP.Create(stream);
|
||||
var xzp = SabreTools.Serialization.Wrappers.XZP.Create(stream);
|
||||
if (xzp == null)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Interfaces\BinaryObjectScanner.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -19,8 +19,12 @@
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'!='net48'">
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.1.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -14,7 +14,11 @@ namespace BinaryObjectScanner.Interfaces
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <returns>Detected file or protection type, null on error</returns>
|
||||
/// <remarks>Ideally, this should just point to the other detect implementation.</remarks>
|
||||
#if NET48
|
||||
string Detect(string file, bool includeDebug);
|
||||
#else
|
||||
string? Detect(string file, bool includeDebug);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Check if a stream is detected as this file type
|
||||
@@ -23,6 +27,10 @@ namespace BinaryObjectScanner.Interfaces
|
||||
/// <param name="file">Path to the input file</param>
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <returns>Detected file or protection type, null on error</returns>
|
||||
#if NET48
|
||||
string Detect(Stream stream, string file, bool includeDebug);
|
||||
#else
|
||||
string? Detect(Stream stream, string file, bool includeDebug);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ namespace BinaryObjectScanner.Interfaces
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <returns>Path to extracted files, null on error</returns>
|
||||
/// <remarks>Ideally, this should just point to the other extract implementation.</remarks>
|
||||
#if NET48
|
||||
string Extract(string file, bool includeDebug);
|
||||
#else
|
||||
string? Extract(string file, bool includeDebug);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Extract a stream to a temporary path, if possible
|
||||
@@ -25,6 +29,10 @@ namespace BinaryObjectScanner.Interfaces
|
||||
/// <param name="file">Path to the input file</param>
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <returns>Path to extracted files, null on error</returns>
|
||||
#if NET48
|
||||
string Extract(Stream stream, string file, bool includeDebug);
|
||||
#else
|
||||
string? Extract(Stream stream, string file, bool includeDebug);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -63,7 +67,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -42,7 +46,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -52,7 +56,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -46,7 +50,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Compression\BinaryObjectScanner.Compression.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Interfaces\BinaryObjectScanner.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.1.1" />
|
||||
<PackageReference Include="SabreTools.Matching" Version="1.1.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.1" />
|
||||
<PackageReference Include="WiseUnpacker" Version="1.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -48,7 +48,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -60,7 +64,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -75,7 +75,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -87,7 +91,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -41,7 +45,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -33,7 +33,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -45,7 +49,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -44,7 +48,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -70,7 +74,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -41,7 +45,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -43,7 +47,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -46,7 +50,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -61,7 +65,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -45,7 +49,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
// TODO: Add extraction
|
||||
if (!File.Exists(file))
|
||||
@@ -50,7 +54,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -54,7 +58,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -37,7 +41,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -51,7 +55,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -58,7 +62,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -38,7 +42,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -76,7 +80,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -43,7 +47,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -65,7 +65,11 @@ namespace BinaryObjectScanner.Packer
|
||||
// TODO: Find a way to generically detect 2.X versions and improve exact version detection for SFX PE versions bundled with WinZip 11+
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -77,7 +81,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -77,7 +77,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -89,7 +93,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
return null;
|
||||
@@ -41,7 +45,11 @@ namespace BinaryObjectScanner.Packer
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET48
|
||||
public string Extract(Stream stream, string file, bool includeDebug)
|
||||
#else
|
||||
public string? Extract(Stream stream, string file, bool includeDebug)
|
||||
#endif
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -21,12 +21,17 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Interfaces\BinaryObjectScanner.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Utilities\BinaryObjectScanner.Utilities.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.1.1" />
|
||||
<PackageReference Include="SabreTools.Matching" Version="1.1.0" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.1.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net48'">
|
||||
<PackageReference Include="System.Memory" Version="4.5.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -19,9 +19,14 @@
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'!='net48'">
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.1.1" />
|
||||
<PackageReference Include="SabreTools.Matching" Version="1.1.0" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.1.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Utilities;
|
||||
using System.IO;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
namespace BinaryObjectScanner.Wrappers
|
||||
namespace BinaryObjectScanner.Utilities
|
||||
{
|
||||
public static class WrapperFactory
|
||||
{
|
||||
@@ -34,7 +32,7 @@ namespace BinaryObjectScanner.Wrappers
|
||||
//case SupportedFileType.IniFile: return IniFile.Create(data);
|
||||
//case SupportedFileType.InstallShieldArchiveV3: return InstallShieldArchiveV3.Create(data);
|
||||
case SupportedFileType.InstallShieldCAB: return InstallShieldCabinet.Create(data);
|
||||
//case SupportedFileType.LDSCRYPT: return BinaryObjectScanner.Wrappers.LDSCRYPT.Create(data);
|
||||
//case SupportedFileType.LDSCRYPT: return LDSCRYPT.Create(data);
|
||||
case SupportedFileType.MicrosoftCAB: return MicrosoftCabinet.Create(data);
|
||||
//case SupportedFileType.MicrosoftLZ: return MicrosoftLZ.Create(data);
|
||||
//case SupportedFileType.MPQ: return MoPaQ.Create(data);
|
||||
@@ -1,40 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net48;net6.0;net7.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
|
||||
<Version>2.8</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
<Product>BurnOutSharp</Product>
|
||||
<Copyright>Copyright (c)2022-2023 Matt Nadareski</Copyright>
|
||||
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/mnadareski/BurnOutSharp</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'!='net48'">
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Compression\BinaryObjectScanner.Compression.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Utilities\BinaryObjectScanner.Utilities.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.1.1" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.1.2" />
|
||||
<PackageReference Include="SabreTools.Printing" Version="1.1.0" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.1.5" />
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -16,8 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BinaryObjectScanner.Wrappers", "BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj", "{35BD489F-E58D-45DD-9929-DC4B32414750}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "psxt001z", "psxt001z\psxt001z.csproj", "{D9574B47-0D6B-445A-97BF-272B5EF9AD3F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BinaryObjectScanner.Utilities", "BinaryObjectScanner.Utilities\BinaryObjectScanner.Utilities.csproj", "{3C1D1FE2-7E7C-4EC1-96B1-FE68B73282CD}"
|
||||
@@ -48,10 +46,6 @@ Global
|
||||
{88735BA2-778D-4192-8EB2-FFF6843719E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88735BA2-778D-4192-8EB2-FFF6843719E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88735BA2-778D-4192-8EB2-FFF6843719E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{35BD489F-E58D-45DD-9929-DC4B32414750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{35BD489F-E58D-45DD-9929-DC4B32414750}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{35BD489F-E58D-45DD-9929-DC4B32414750}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{35BD489F-E58D-45DD-9929-DC4B32414750}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D9574B47-0D6B-445A-97BF-272B5EF9AD3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D9574B47-0D6B-445A-97BF-272B5EF9AD3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D9574B47-0D6B-445A-97BF-272B5EF9AD3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -64,10 +64,6 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\psxt001z\psxt001z.csproj">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
|
||||
using BinaryObjectScanner.FileType;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using BinaryObjectScanner.Utilities;
|
||||
using BinaryObjectScanner.Wrappers;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
using static BinaryObjectScanner.Utilities.Dictionary;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using BinaryObjectScanner.Utilities;
|
||||
using BinaryObjectScanner.Wrappers;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
<ProjectReference Include="..\BurnOutSharp\BurnOutSharp.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.FileType\BinaryObjectScanner.FileType.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Utilities\BinaryObjectScanner.Utilities.csproj" />
|
||||
<ProjectReference Include="..\BinaryObjectScanner.Wrappers\BinaryObjectScanner.Wrappers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user