0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-24 12:15:17 +00:00

Implement tag packet serde

This commit is contained in:
Sanae 2022-03-15 01:39:33 -06:00
parent 3a8b38142e
commit fca90851ad

View file

@ -12,11 +12,17 @@ public struct TagPacket : IPacket {
public short Size => 4; public short Size => 4;
public void Serialize(Span<byte> data) { public void Serialize(Span<byte> data) {
MemoryMarshal.Write(data, ref IsIt); MemoryMarshal.Write(data, ref UpdateType);
MemoryMarshal.Write(data[1..], ref IsIt);
MemoryMarshal.Write(data[2..], ref Seconds);
MemoryMarshal.Write(data[3..], ref Minutes);
} }
public void Deserialize(Span<byte> data) { public void Deserialize(Span<byte> data) {
IsIt = MemoryMarshal.Read<bool>(data); UpdateType = MemoryMarshal.Read<bool>(data);
IsIt = MemoryMarshal.Read<bool>(data[1..]);
Seconds = MemoryMarshal.Read<byte>(data[2..]);
Minutes = MemoryMarshal.Read<ushort>(data[3..]);
} }
[Flags] [Flags]