From e9ee2f8b120b5210e16d824fe60fe896048deb8e Mon Sep 17 00:00:00 2001 From: Schwirg László Date: Wed, 22 Sep 2021 16:59:43 +0200 Subject: [PATCH] v1.8.4 - IP Pinger felület fejlesztése --- Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs | 2 +- Vrh.Log4Pro.MaintenanceConsole/Manager - MaintenanceToolManager.cs | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- Vrh.Log4Pro.MaintenanceConsole/Program.cs | 32 ++++++++++++++++++++++++++++++++ Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 105 insertions(+), 23 deletions(-) diff --git a/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs index ac3db91..4c555a4 100644 --- a/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs +++ b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs @@ -116,7 +116,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ColorConsoleNS { int currentLineCursor = Console.CursorTop; int currentColCursor = Console.CursorLeft; - if (height == 0) { height = Console.WindowHeight; } + if (height == 0) { height = Console.WindowHeight- Console.CursorTop; } for (var i=0;i20?20: rttlstring.Length) + (rttlstring.Length > 20 ? "..." : ""), ConsoleColor.Yellow, prefix: " roundtrip time limit values :", suffix: "ms"); - ColorConsole.WriteLine((string.Join(",", pconfig.RoundTripTimeyCategoryLimits)).ToString(), ConsoleColor.Yellow, prefix: " roundtrip time category limit values:", suffix: "ms"); + ColorConsole.WriteLine(rttlstring.Substring(0, rttlstring.Length > 40 ? 40 : rttlstring.Length) + (rttlstring.Length > 40 ? "..." : ""), ConsoleColor.Yellow, prefix: " roundtrip time interval limit values:", suffix: " ms"); + ColorConsole.Write("", ConsoleColor.Yellow, prefix: " roundtrip time category limit values:"); + ColorConsole.Write(pconfig.RoundTripTimeyCategoryLimits.ElementAt(0).ToString(), ConsoleColor.Yellow, suffix: "ms <= "); + ColorConsole.Write("Q1", ConsoleColor.Yellow, suffix: " < "); + ColorConsole.Write(pconfig.RoundTripTimeyCategoryLimits.ElementAt(1).ToString(), ConsoleColor.Yellow, suffix: "ms <= "); + ColorConsole.Write("Q2", ConsoleColor.Yellow, suffix: " < "); + ColorConsole.Write(pconfig.RoundTripTimeyCategoryLimits.ElementAt(2).ToString(), ConsoleColor.Yellow, suffix: "ms <= "); + ColorConsole.Write("Q3", ConsoleColor.Yellow, suffix: " < "); + ColorConsole.Write(pconfig.RoundTripTimeyCategoryLimits.ElementAt(3).ToString(), ConsoleColor.Yellow, suffix: "ms <= "); + ColorConsole.Write("Q4", ConsoleColor.Yellow, suffix: ""); + ColorConsole.WriteLine(); + } + private static void DisplayHistoryMarksForOneLostPackageCategory(Pinger.PingerConfig pconfig, ConsoleColor c, string text) + { + ColorConsole.Write("", ConsoleColor.Yellow, prefix: text); + ColorConsole.Write(MARKQ1, c, suffix: " "); + ColorConsole.Write(MARKQ2, c, suffix: " "); + ColorConsole.Write(MARKQ3, c, suffix: " "); + ColorConsole.Write(MARKQ4, c, suffix: " "); + ColorConsole.WriteLine(); } private static void DisplayPingerHistory(List selectedpingers,int firstrow,int cc) { if (selectedpingers == null || !selectedpingers.Any()) { return; } ColorConsole.SetCursorPosition(cc, firstrow); - - ColorConsole.ClearLine();ColorConsole.WriteLine(); - ColorConsole.ClearLine();ColorConsole.WriteLine($"Pinger History:", ConsoleColor.Yellow); + ColorConsole.ClearArea(0, selectedpingers.Count+ 10); + ColorConsole.WriteLine(); + ColorConsole.WriteLine($"Pinger History:", ConsoleColor.Yellow); var cursorleftposition = ColorConsole.CursorLeft; var cursortopposition = ColorConsole.CursorTop; while (true) @@ -213,8 +259,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS foreach (var pinger in selectedpingers) { pingcyclefrequency=DisplayOnePingerHistory(pinger); if (ColorConsole.KeyAvailable) { goto finishdisplayhistory; };} var elapsed = DateTime.Now.Subtract(monitorcyclestart).TotalMilliseconds; if (elapsed < pingcyclefrequency) { Thread.Sleep((int)((double)pingcyclefrequency - elapsed)); } - ColorConsole.ClearLine(); ColorConsole.WriteLine(); - ColorConsole.ClearLine(); ColorConsole.WriteLine($"Press any key to exit from monitoring...", ConsoleColor.Yellow); + ColorConsole.WriteLine(); + ColorConsole.WriteLine($"Press any key to exit from monitoring...", ConsoleColor.Yellow); } finishdisplayhistory:; } @@ -249,10 +295,14 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS return h.PingCycleFrequency; } private static string GetPingCycleDisplayCharacter(Pinger.PingCycle he) - { - return he.StatusCategory != Pinger.PingCycle.IPStatusCategory.Success - ? "9" - : he.RoundtripTimeCategory.ToString().Substring(1); + { + return he.StatusCategory != Pinger.PingCycle.IPStatusCategory.Success + ? MARKQ1 //"9" + : he.RoundtripTimeCategory == Pinger.PingCycle.RoundTripTimeCategory.Q1 ? MARKQ1 + : he.RoundtripTimeCategory == Pinger.PingCycle.RoundTripTimeCategory.Q2 ? MARKQ2 + : he.RoundtripTimeCategory == Pinger.PingCycle.RoundTripTimeCategory.Q3 ? MARKQ3 + : he.RoundtripTimeCategory == Pinger.PingCycle.RoundTripTimeCategory.Q4 ? MARKQ4 + : ""; } private static ConsoleColor GetPingCycleDisplayColor(Pinger.PingCycle pingcycle) { diff --git a/Vrh.Log4Pro.MaintenanceConsole/Program.cs b/Vrh.Log4Pro.MaintenanceConsole/Program.cs index 1553f62..9a47cf9 100644 --- a/Vrh.Log4Pro.MaintenanceConsole/Program.cs +++ b/Vrh.Log4Pro.MaintenanceConsole/Program.cs @@ -35,6 +35,38 @@ namespace Vrh.Log4Pro.MaintenanceConsole { static void Main(string[] args) { + //while (true) + //{ + // Console.Clear(); + // Console.Write("Enter string:"); var cp1 = Console.ReadLine(); + // Console.WriteLine(); + // Console.ForegroundColor = ConsoleColor.Red; + // Console.Write(cp1); foreach (char c in cp1) { Console.Write(c); Console.Write(" => "); var i = (int)c; Console.Write(i); Console.Write(" => "); Console.Write((char)i); Console.WriteLine(); } + // Console.ForegroundColor = ConsoleColor.DarkGreen; + // Console.Write(cp1); foreach (char c in cp1) { Console.Write(c); Console.Write(" => "); var i = (int)c; Console.Write(i); Console.Write(" => "); Console.Write((char)i); Console.WriteLine(); } + // Console.ForegroundColor = ConsoleColor.Green; + // Console.Write(cp1); foreach (char c in cp1) { Console.Write(c); Console.Write(" => "); var i = (int)c; Console.Write(i); Console.Write(" => "); Console.Write((char)i); Console.WriteLine(); } + // Console.ForegroundColor = ConsoleColor.DarkYellow; + // Console.Write(cp1); foreach (char c in cp1) { Console.Write(c); Console.Write(" => "); var i = (int)c; Console.Write(i); Console.Write(" => "); Console.Write((char)i); Console.WriteLine(); } + // Console.ForegroundColor = ConsoleColor.Yellow; + // Console.Write(cp1); foreach (char c in cp1) { Console.Write(c); Console.Write(" => "); var i = (int)c; Console.Write(i); Console.Write(" => "); Console.Write((char)i); Console.WriteLine(); } + // Console.ReadKey(); + // Console.Clear(); + // Console.Write("Enter Code page:"); var cp = Console.ReadLine(); + // try + // { + // Console.OutputEncoding = System.Text.Encoding.GetEncoding(int.Parse(cp)); + // for (int i = 0; i < 256; i++) + // { + // Console.Write((i).ToString().PadLeft(3) + "=> [" + (char)(i) + "] "); + // if (i % 6 == 5) { Console.WriteLine(); } + // //Console.Write((char)(i*j)); + // } + // } + // catch { Console.WriteLine("Code page is not supported!"); } + // Console.ReadKey(); + //} + var forcedmodulekey = CommandLine.GetCommandLineArgument(args, CLP.CMD_MODULE); var commandmode = !string.IsNullOrEmpty(forcedmodulekey); var silentmode = commandmode && !string.IsNullOrEmpty(CommandLine.GetCommandLineArgument(args, CLP.CMD_SILENT, switchtype: true)); diff --git a/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs b/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs index 203ef90..bceaa7c 100644 --- a/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs +++ b/Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.3.0")] -[assembly: AssemblyFileVersion("1.8.3.0")] +[assembly: AssemblyVersion("1.8.4.0")] +[assembly: AssemblyFileVersion("1.8.4.0")] -- libgit2 0.21.2