mirror of
https://github.com/kwsch/pkNX.git
synced 2026-03-22 02:04:15 -05:00
Cumulative changes from the team. Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com> Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com> Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
26 lines
677 B
C#
26 lines
677 B
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace pkNX.Containers;
|
|
|
|
public static class TrinityUtil
|
|
{
|
|
public static string GuessExtension(ReadOnlySpan<byte> data)
|
|
{
|
|
const string defaultExtension = "bin";
|
|
if (data.Length < 8)
|
|
return defaultExtension;
|
|
var u32 = ReadUInt32LittleEndian(data);
|
|
if (ReadUInt32LittleEndian(data[4..8]) == 0x53424642)
|
|
return "bfbs";
|
|
return u32 switch
|
|
{
|
|
AHTB.Magic => "ahtb",
|
|
0x43524153 => "sarc",
|
|
0x58544E42 => "bntx",
|
|
0x63726173 => "sarc",
|
|
_ => defaultExtension,
|
|
};
|
|
}
|
|
}
|