pkNX/pkNX.Containers/Misc/DatEntry.cs
Kurt 58b0597fea Sword/Shield Update
Many thanks to @SciresM and @sora10pls for assisting in this massive
update!
2019-11-15 17:00:41 -08:00

38 lines
1.0 KiB
C#

using System.IO;
namespace pkNX.Containers
{
public readonly struct DatEntry
{
public readonly ulong Hash;
public readonly int Value;
public DatEntry(ulong hash, int value)
{
Hash = hash;
Value = value;
}
public DatEntry(BinaryReader br)
{
Hash = br.ReadUInt64();
Value = br.ReadInt32();
br.ReadInt32();
}
public void Write(BinaryWriter bw)
{
bw.Write(Hash);
bw.Write(Value);
bw.Write(0);
}
public string Summary => $"{Hash:X16}\t{Value}";
public override bool Equals(object obj) => obj is DatEntry d && Equals(d);
public bool Equals(DatEntry d) => d.Hash == Hash;
public override int GetHashCode() => Hash.GetHashCode();
public static bool operator ==(DatEntry left, DatEntry right) => left.Equals(right);
public static bool operator !=(DatEntry left, DatEntry right) => !(left == right);
}
}