public static void TestTargetIP2Disconnected() { while (true) { if (targetIP2lastStatus != NetworkStatus.Offline && !PingUtil.IsConnected(targetIP2)) { timePoints2.Add(new TimePoint(DateTime.Now, NetworkStatus.Offline)); pingTarget2Count = 0; targetIP2GroupCount++; targetIP2lastStatus = NetworkStatus.Offline; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(FormatDisconnectedConsoleLog(targetIP2, targetIP2GroupCount)); Console.ForegroundColor = ConsoleColor.White; log2.Info(FormatDisconnectedFileLog(targetIP2, targetIP2GroupCount)); } Thread.Sleep(sleepTime); } }
public static void TestTargetIP2Connecting() { while (true) { if (targetIP2lastStatus != NetworkStatus.Online) { pingTarget2Count++; if (PingUtil.IsConnected(targetIP2)) { timePoints2.Add(new TimePoint(DateTime.Now, NetworkStatus.Online)); targetIP2lastStatus = NetworkStatus.Online; Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(FormatConnectingConsoleLog(targetIP2, pingTarget2Count)); Console.ForegroundColor = ConsoleColor.White; log2.Info(FormatConnectingFileLog(targetIP2, pingTarget2Count)); } } Thread.Sleep(sleepTime); } }