0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 03:05:16 +00:00

Fix ChangeStage packet deserializer

This commit is contained in:
Sanae 2022-04-05 13:43:56 -06:00
parent a89471de54
commit e75df1bbb4

View file

@ -1,4 +1,5 @@
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Shared.Packet.Packets;
@ -20,6 +21,9 @@ public struct ChangeStagePacket : IPacket {
MemoryMarshal.Write(data[(IdSize + StageSize + 1)..(IdSize + StageSize + 2)], ref SubScenarioType);
}
public void Deserialize(ReadOnlySpan<byte> data) {
throw new NotImplementedException("This packet should not be sent by the client.");
Stage = Encoding.UTF8.GetString(data[..StageSize]).TrimNullTerm();
Id = Encoding.UTF8.GetString(data[StageSize..(IdSize + StageSize)]).TrimNullTerm();
Scenario = MemoryMarshal.Read<sbyte>(data[(IdSize + StageSize)..(IdSize + StageSize + 1)]);
SubScenarioType = MemoryMarshal.Read<byte>(data[(IdSize + StageSize + 1)..(IdSize + StageSize + 2)]);
}
}