public static void Handle(byte[] buffer) { var packetId = BitConverter.ToUInt16(buffer, 4); if (Global.Verbose) { FConsole.WriteLine($"Got Packet {packetId}"); } switch (packetId) { case 1000: Login.Handle(buffer); break; case 1001: Walk.Handle(buffer); break; case 1002: Ping.Handle(buffer); break; case 1003: Spawn.Handle(buffer); break; } ArrayPool <byte> .Shared.Return(buffer); }
public static void Handle(NetworkClient socket, byte[] buffer) { var packetId = BitConverter.ToUInt16(buffer, 4); var player = socket.Player; switch (packetId) { case 1000: { Login.Handle(player, buffer); break; } case 1001: { Walk.Handle(player, buffer); break; } case 1002: { Ping.Handle(player, buffer); break; } } }