private void SendChatRoomClientUpdate(IChatClient updatedClient, ChatRoomClientUpdateType updateType) { foreach (var client in this.connectedClients) { client.SendChatRoomClientUpdate(updatedClient.Index, updatedClient.Nickname ?? string.Empty, updateType); } }
/// <inheritdoc/> public void SendChatRoomClientUpdate(byte updatedClientId, string updatedClientName, ChatRoomClientUpdateType updateType) { using var writer = this.connection.StartSafeWrite(0xC1, 0x0F); var packet = writer.Span; packet[2] = 0x01; packet[3] = (byte)updateType; packet[4] = updatedClientId; packet.Slice(5).WriteString(updatedClientName, Encoding.UTF8); writer.Commit(); }
/// <inheritdoc/> public void SendChatRoomClientUpdate(byte updatedClientId, string updatedClientName, ChatRoomClientUpdateType updateType) { var packet = new byte[0x0F]; packet[0] = 0xC1; packet[1] = 0x0F; packet[2] = 0x01; packet[3] = (byte)updateType; packet[4] = updatedClientId; Encoding.UTF8.GetBytes(updatedClientName, 0, updatedClientName.Length, packet, 5); this.connection.Send(packet); }