Add VPK to info

This commit is contained in:
Matt Nadareski
2022-12-24 14:24:34 -08:00
parent b025c7a7fa
commit fbb33d9ef8
3 changed files with 32 additions and 2 deletions

View File

@@ -261,7 +261,7 @@ namespace BurnOutSharp.Tools
#region VPK
if (magic.StartsWith(new byte?[] { 0x34, 0x12, 0x55, 0xaa }))
if (magic.StartsWith(new byte?[] { 0x34, 0x12, 0xaa, 0x55 }))
return SupportedFileType.VPK;
#endregion

View File

@@ -343,6 +343,25 @@ namespace Test
cabinet.Print();
}
// VPK
else if (IsVPK(magic))
{
// Build the archive information
Console.WriteLine("Creating VPK deserializer");
Console.WriteLine();
var vpk = VPK.Create(stream);
if (vpk == null)
{
Console.WriteLine("Something went wrong parsing VPK");
Console.WriteLine();
return;
}
// Print the VPK info to screen
vpk.Print();
}
// Everything else
else
{
@@ -430,6 +449,17 @@ namespace Test
return magic[0] == 'P' && magic[1] == 'E' && magic[2] == '\0' && magic[3] == '\0';
}
/// <summary>
/// Determine if the magic bytes indicate an VPK
/// </summary>
private static bool IsVPK(byte[] magic)
{
if (magic == null || magic.Length < 4)
return false;
return magic[0] == 0x34 && magic[1] == 0x12 && magic[2] == 0xaa && magic[3] == 0x55;
}
#endregion
}
}