mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Allow any file with the correct BSA headers to be extracted with the BSA extractor.
This commit is contained in:
parent
7bc5ded82c
commit
2b5adb3d8e
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Wabbajack.Common;
|
||||
|
||||
@ -22,5 +23,13 @@ namespace Compression.BSA
|
||||
return new BA2Reader(filename);
|
||||
throw new InvalidDataException("Filename is not a .bsa or .ba2, magic " + fourcc);
|
||||
}
|
||||
|
||||
private static HashSet<string> MagicStrings = new HashSet<string> {TES3Reader.TES3_MAGIC, "BSA\0", "BTDX"};
|
||||
public static bool MightBeBSA(AbsolutePath filename)
|
||||
{
|
||||
using var file = filename.OpenRead();
|
||||
var fourcc = Encoding.ASCII.GetString(new BinaryReader(file).ReadBytes(4));
|
||||
return MagicStrings.Contains(fourcc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace Wabbajack.VirtualFileSystem
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Consts.SupportedBSAs.Contains(source.Extension))
|
||||
if (BSADispatch.MightBeBSA(source))
|
||||
return await ExtractAllWithBSA(queue, source);
|
||||
else if (source.Extension == Consts.OMOD)
|
||||
return await ExtractAllWithOMOD(source);
|
||||
|
Loading…
Reference in New Issue
Block a user