Пример #1
0
        /// <summary>
        /// 系统事件
        /// </summary>
        private void OnSystemEvent(ServiceType type, string message)
        {
            var msg = new ServiceEventArgs(type)
            {
                Message = message
            };

            OnSystemEvent(msg);
        }
Пример #2
0
        /// <summary>
        /// 抛出连接完成事件
        /// </summary>
        protected virtual void ClientFinished(IPEndPoint point)
        {
            var msg = new ServiceEventArgs(ServiceType.Connect)
            {
                Ip   = point.Address.ToString(),
                Port = point.Port
            };

            OnSystemEvent(msg);
        }
Пример #3
0
 /// <summary>
 /// 系统事件
 /// </summary>
 private void OnSystemEvent(ServiceEventArgs msg)
 {
     try
     {
         if (msg.Message != null)
         {
             new WarningException(msg.Message).Log();
         }
         SystemEvent?.Invoke(msg);
     }
     catch (Exception ex)
     {
         ex.Log();
     }
 }
Пример #4
0
 /// <summary>
 /// 触发客户端日志
 /// </summary>
 /// <param name="message"></param>
 internal void OnClientEvent(string message)
 {
     try
     {
         var msg = new ServiceEventArgs(ServiceType.Client)
         {
             Ip      = IPPoint.ToString(),
             Port    = IPPoint.Port,
             Message = message
         };
         ClientEvent?.Invoke(msg);
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
 }
Пример #5
0
 /// <summary>
 /// 触发socker异常事件->断开
 /// </summary>
 internal virtual void OnDisConnectEvent(SocketError type)
 {
     try
     {
         var msg = new ServiceEventArgs(ServiceType.DisConnect)
         {
             SocketError = type,
             Message     = type.ToString(),
             Ip          = IPPoint.Address.ToString(),
             Port        = IPPoint.Port
         };
         ClientEvent?.Invoke(msg);
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
 }
Пример #6
0
 /// <summary>
 /// 客户端事件与断开连接事件
 /// </summary>
 /// <param name="e"></param>
 private void Client_ClientEvent(ServiceEventArgs e)
 {
     OnSystemEvent(e);
 }