public static int SendUnicodeMessage( ArraySegment <byte>[] buffer, Serial serial, int graphic, MessageType type, int hue, int font, string lang, string name, string text ) { name = name?.Trim() ?? ""; text = text?.Trim() ?? ""; lang = lang?.Trim() ?? "ENU"; if (hue == 0) { hue = 0x3B2; } var writer = new CircularBufferWriter(buffer); writer.Write((byte)0xAE); writer.Write((ushort)(50 + text.Length * 2)); writer.Write(serial); writer.Write((short)graphic); writer.Write((byte)type); writer.Write((short)hue); writer.Write((short)font); writer.WriteAscii(lang, 4); writer.WriteAscii(name, 30); writer.WriteBigUniNull(text); return(writer.Position); }
public static void SendHelpResponse(this NetState ns, Serial s, string text) { text = text?.Trim() ?? ""; if (ns == null || text.Length == 0 || !ns.GetSendBuffer(out var buffer)) { return; } var writer = new CircularBufferWriter(buffer); writer.Write((byte)0xB7); writer.Write((ushort)(9 + text.Length * 2)); writer.Write(s); writer.WriteBigUniNull(text); ns.Send(ref buffer, writer.Position); }