Beispiel #1
0
 /// <summary>
 /// Method responsible for execute the callback of on message received handler.
 /// </summary>
 /// <param name="client">The client instance.</param>
 /// <param name="kingBuffer">The king buffer from received message.</param>
 private void OnMessageReceived(IClient client, IKingBuffer kingBuffer)
 {
     try
     {
         switch (kingBuffer.ReadMessagePacket <MyPackets>())
         {
         case MyPackets.Message:
             Console.WriteLine($"Received message: {kingBuffer.ReadString()}.");
             _server.SendMessageToAllMinus(client, kingBuffer);
             break;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Error: {ex.Message}.");
     }
 }
Beispiel #2
0
 public void OnMessageReceived(IKingBuffer kingBuffer)
 {
     AddMessage(kingBuffer.ReadString());
 }