/// <summary>
        /// Pings the reply event handler.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="PingReplyEventArgs"/> instance containing the event data.</param>
        /// <autogeneratedoc />
        private void PingReplyEventHandler(object sender, PingReplyEventArgs args)
        {
            sender.Should().BeAssignableTo <IPingTask>();

            if (args != null)
            {
                TestOutputHelper.WriteLine(
                    $"Job: {args.PingJob.JobGuid}, TaskId: {args.PingJob.TaskId}, IPAddressSubnet: {args.PingJob.IPAddressSubnet}, Status: {args.PingReply.Status}");
            }
        }
示例#2
0
        static void onReply(PingReplyEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("onReply: " + args.message);
            ReplyEventHandler handler = onReplyEvent;

            if (handler != null)
            {
                handler("pingReply", args);
            }
        }
示例#3
0
        private void PingReplyLoggingEventHandler(object sender, PingReplyEventArgs args)
        {
            if (args == null || !EnableLogging)
            {
                return;
            }

            using (Logger?.BeginScope("[{Timestamp}:{JobId}:{TaskId}]", args.PingJob.Timestamp,
                                      args.PingJob.JobGuid, args.PingJob.TaskId))
            {
                var pingReply = args.PingReply;

                if (pingReply.Status == IPStatus.Success)
                {
                    using (Logger?.PushLogProperties(
                               pingReply.GetLogPropertyListLevel(LogLevel.Information, LoggableFormat.ToLog)))
                    {
                        Logger?.LogInformation("Ping {Status} to {IPAddressSubnet}", args.PingReply.Status,
                                               args.PingJob.IPAddressSubnet);
                    }
                }
                else if (pingReply.Status == IPStatus.TimedOut)
                {
                    using (Logger?.PushLogProperties(
                               pingReply.GetLogPropertyListLevel(LogLevel.Trace, LoggableFormat.ToLog)))
                    {
                        Logger?.LogTrace("Ping {Status} for {IPAddressSubnet}", args.PingReply.Status,
                                         args.PingJob.IPAddressSubnet);
                    }
                }
                else
                {
                    using (Logger?.PushLogProperties(
                               pingReply.GetLogPropertyListLevel(LogLevel.Debug, LoggableFormat.ToLog)))
                    {
                        Logger?.LogDebug("Ping {Status} for {IPAddressSubnet}", args.PingReply.Status,
                                         args.PingJob.IPAddressSubnet);
                    }
                }
            }
        }
示例#4
0
 private void PingTaskReplyEventHandler(object sender, PingReplyEventArgs pingReplyEventArgs)
 {
     OnPingReplyService?.Invoke(this, pingReplyEventArgs);
 }
示例#5
0
 static void onReply(PingReplyEventArgs args)
 {
     System.Diagnostics.Debug.WriteLine("onReply: " + args.message);
     ReplyEventHandler handler = onReplyEvent;
     if (handler != null)
     {
         handler("pingReply", args);
     }
 }
示例#6
0
 private static void OnPingReply(object sender, PingReplyEventArgs pingReplyEventArgs)
 {
     var information = MethodBase.GetCurrentMethod().Name;
     try
     {
         var serverUser = GetServerUser(sender);
         Trace.WriteLine(information, serverUser.ToString());
     }
     catch (Exception ex)
     {
         Console.WriteLine("{0} exception {1}", information, ex.Message);
     }
 }
示例#7
0
 protected void RaiseGotPingReply(PingReplyEventArgs e)
 {
     Dispatch(GotPingReply, e);
 }
示例#8
0
 protected virtual void OnGotPingReply(PingReplyEventArgs e)
 {
     RaiseGotPingReply(e);
 }