/// <summary> /// Parse the raw data received from the server and create Message structures. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="Data">Line of data received.</param> void BaseMessageClient_OnDataReceived(Client sender, Data Data) { TCPMessage msg = null; try { msg = TCPMessage.FromByteArray(Data.Message); } catch (Exception) { } if (msg != null) if (OnMessageReceived != null) OnMessageReceived(sender, msg); }
/// <summary> /// Parse the raw data sent to the server and create Message structures. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="Data">Line of data sent.</param> void BaseMessageClient_OnDataSent(Client sender, Data Data) { TCPMessage msg = TCPMessage.FromByteArray(Data.Message); if (OnAfterMessageSent != null) OnAfterMessageSent(sender, msg); }
/// <summary> /// When the connection is rejected by the server raise the correct event. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="Message">Message of the server.</param> void BaseMessageClient_OnConnectFailed(Client sender, byte[] Message) { if (TCPLibrary.MessageBased.Core.TCPMessage.FromByteArray(Message).MessageType == MessageType.MaxUsers) if (OnMaxUsersConnectionFail != null) OnMaxUsersConnectionFail(sender); }