using System.IO; using System.Threading.Tasks; namespace Passer.Control.Core { 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 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; } } }