mirror of
https://github.com/kwsch/pkNX.git
synced 2026-04-22 09:38:08 -05:00
File scoped namespaces for all lib projects netstandard2.0 => net6; now uniform. bye netframework!
37 lines
894 B
C#
37 lines
894 B
C#
using System.IO;
|
|
|
|
namespace pkNX.Containers;
|
|
|
|
public class AHTBEntry
|
|
{
|
|
public ulong Hash;
|
|
public ushort NameLength;
|
|
public string Name;
|
|
|
|
public AHTBEntry(ulong hash, ushort namelen, string name)
|
|
{
|
|
Hash = hash;
|
|
NameLength = namelen;
|
|
Name = name;
|
|
}
|
|
|
|
public AHTBEntry(BinaryReader br)
|
|
{
|
|
Hash = br.ReadUInt64();
|
|
NameLength = br.ReadUInt16();
|
|
Name = br.ReadStringBytesUntil(0); // could use Length field, but they're always \0 terminated
|
|
//Debug.Assert(FnvHash.HashFnv1a_64(Name) == Hash);
|
|
//Debug.Assert(Name.Length + 1 == NameLength); // Always null terminated
|
|
}
|
|
|
|
public void Write(BinaryWriter bw)
|
|
{
|
|
bw.Write(Hash);
|
|
bw.Write(Name.Length + 1);
|
|
bw.Write(Name);
|
|
bw.Write((byte)0); // \0 terminator
|
|
}
|
|
|
|
public string Summary => $"{Hash:X16}\t{Name}";
|
|
}
|