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:
parent
3a8b38142e
commit
fca90851ad
1 changed files with 8 additions and 2 deletions
|
@ -12,11 +12,17 @@ public struct TagPacket : IPacket {
|
|||
public short Size => 4;
|
||||
|
||||
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) {
|
||||
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]
|
||||
|
|
Loading…
Reference in a new issue