Clean up MS-CAB SFX a little

This commit is contained in:
Matt Nadareski
2021-08-23 23:09:05 -07:00
parent dc49335ace
commit 177641894e

View File

@@ -7,9 +7,6 @@ namespace BurnOutSharp.PackerType
// TODO: Add extraction, which should be possible with LibMSPackN, but it refuses to extract due to SFX files lacking the typical CAB identifiers.
public class MicrosoftCABSFX : IContentCheck
{
/// <inheritdoc/>
public bool ShouldScan(byte[] magic) => true;
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
@@ -18,11 +15,23 @@ namespace BurnOutSharp.PackerType
string name = fvinfo?.InternalName.Trim();
if (!string.IsNullOrWhiteSpace(name) && name.Equals("Wextract", StringComparison.OrdinalIgnoreCase))
return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}";
{
string version = GetVersion(file, fileContent, null);
if (!string.IsNullOrWhiteSpace(version))
return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}";
return "Microsoft CAB SFX";
}
name = fvinfo?.OriginalFilename.Trim();
if (!string.IsNullOrWhiteSpace(name) && name.Equals("WEXTRACT.EXE", StringComparison.OrdinalIgnoreCase))
return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}";
{
string version = GetVersion(file, fileContent, null);
if (!string.IsNullOrWhiteSpace(version))
return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}";
return "Microsoft CAB SFX";
}
var matchers = new List<ContentMatchSet>
{