protected virtual void OnMessageLoad(EndPointMessage message) { var sender = Instance.DBTable.LoadById(message.SenderName); if (sender == null) { return; } sender.ReceiveCount++; sender.ReceiveLength += message.Lenght; switch (message.Type) { case (SocketMessageType.Hello): sender.Active = true; break; case (SocketMessageType.Login): sender.Active = true; Send(endPoint.GetBytes(), sender, SocketMessageType.Hello); break; case (SocketMessageType.Logout): sender.Detach(); break; case (SocketMessageType.Data): Deserialize(message.Data); break; } MessageLoad?.Invoke(message); }