2025-02-19 13:08:32 +01:00

31 lines
851 B
C#

using System.IO;
using System.Threading.Tasks;
namespace Passer.RoboidControl {
public class DestroyMsg : IMessage {
public const byte Id = 0x20;
public const byte length = 3;
public byte networkId;
public byte thingId;
public DestroyMsg(byte[] buffer) : base(buffer) { }
public override void Deserialize(byte[] buffer) {
this.networkId = buffer[0];
this.thingId = buffer[1];
}
public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
if (packetSize != length)
return false;
byte[] buffer = await Receive(dataStream, packetSize);
DestroyMsg msg = new DestroyMsg(buffer);
client.messageQueue.Enqueue(msg);
return true;
}
}
}