예제 #1
0
 public void Connect()
 {
     if (client.Connect())
     {
         logger.LogSuccess("Connect request has been sent! Response on event!");
     }
     else
     {
         logger.LogError("Failed to sent connect request!");
     }
 }
예제 #2
0
        public bool Enable()
        {
            if (IsEnabled)
            {
                logger.LogWarning("{0} has already enabled!", Component.GetType().Name);
                return(true);
            }
            else if (Component.Enable())
            {
                logger.LogSuccess("{0} has enabled successfully!", Component.GetType().Name);
                IsEnabled = true;

                return(true);
            }
            else
            {
                logger.LogError("{0} has been failed to enable!!", Component.GetType().Name);
                return(false);
            }
        }
예제 #3
0
        private void Client_OnPacketReceived(object sender, PacketReceivedEventArgs <TCPClient <StreamPacket>, StreamPacket> e)
        {
            logger.LogInfo("Packet 0x{0:X16} has been received from client {1} at {2}", e.Packet.ID, e.Client.EndPoint, e.Time);

            if (e.Packet.ID == ulong.MaxValue)
            {
                string message = e.Packet.ReadString();
                logger.LogSuccess("Received message: {0}", message);

                e.Packet.Reset();
                Server.SendToAll(e.Packet);
            }
            else
            {
                logger.LogWarning("Unknown packet!");
            }
        }
예제 #4
0
 protected override void OnConnected()
 {
     logger.LogSuccess("Client connected to {0}!", Socket.EndPoint);
 }