private void ReceiveMessage(object peer) { NetIncomingMessage message; while ((message = _netClient.ReadMessage()) != null) { switch (message.MessageType) { case NetIncomingMessageType.Data: int eventID = message.ReadInt32(); CefEvent cefEvent = EventRegistry.CreateByID(eventID); cefEvent.Deserialize(message); OnEventReceived(this, new EventReceivedEventArgs { CefEvent = cefEvent }); break; default: break; } } }