22 lines
691 B
C#
22 lines
691 B
C#
namespace Passer.Control.Core {
|
|
|
|
public class TextMsg(byte[] buffer) : IMessage(buffer) {
|
|
public const byte Id = 0xB0;
|
|
public string text = "";
|
|
|
|
public override void Deserialize(byte[] buffer) {
|
|
uint ix = 0;
|
|
uint strlen = buffer[ix++];
|
|
this.text = System.Text.Encoding.UTF8.GetString(buffer, (int)ix, (int)strlen);
|
|
}
|
|
|
|
public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
|
|
byte[] buffer = await Receive(dataStream, packetSize);
|
|
TextMsg msg = new(buffer);
|
|
|
|
client.messageQueue.Enqueue(msg);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
} |