Commit 572da06d958fe364822b1d5ac091c8e33a7608e5

Authored by Schwirg László
1 parent bea496aa

v1.8.2

- pinger javítgatása
Vrh.Log4Pro.MaintenanceConsole/Manager - MaintenanceToolManager.cs
... ... @@ -114,9 +114,15 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS
114 114 while (true)
115 115 {
116 116 DisplayPingerParameters(pingerconfigxml);
117   - DisplayAllPingerStatus(pingerconfigxml,iplist, suppresserroneousipaddresses);
  117 + var cc = ColorConsole.CursorLeft;
  118 + var cr = ColorConsole.CursorTop;
118 119 suppresserroneousipaddresses = true;
119   - if (!firstrun) { DisplayPingerCommands(); }
  120 + DisplayAllPingerStatus(pingerconfigxml, iplist, firstrun, suppresserroneousipaddresses);
  121 + if (!firstrun)
  122 + {
  123 +
  124 + DisplayPingerCommands();
  125 + }
120 126  
121 127 var command = firstrun ? "STARTANDSHOW *" : ColorConsole.ReadLine();
122 128 if (command == "EX") { break; }
... ... @@ -136,10 +142,10 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS
136 142 }
137 143  
138 144 if (cmd.ToLower() == "start") { StartPingers(selectedpingers, pingerconfigxml); }
139   - if (cmd.ToLower() == "startandshow") { StartPingers(selectedpingers, pingerconfigxml); DisplayPingerHistory(selectedpingers); }
  145 + if (cmd.ToLower() == "startandshow") { StartPingers(selectedpingers, pingerconfigxml); DisplayPingerHistory(selectedpingers, cr, cc); }
140 146 else if (cmd.ToLower() == "stop") { StopPingers(selectedpingers); }
141 147 else if (cmd.ToLower() == "drop") { DisposePingers(selectedpingers); }
142   - else if (cmd.ToLower() == "show") { DisplayPingerHistory(selectedpingers); }
  148 + else if (cmd.ToLower() == "show") { DisplayPingerHistory(selectedpingers, cr, cc); }
143 149 else { ColorConsole.WriteLine($"Incorrect answer!", ConsoleColor.Red); continue; }
144 150 firstrun = false;
145 151 }
... ... @@ -189,8 +195,14 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS
189 195 ColorConsole.WriteLine(rttlstring.Substring(0, rttlstring.Length>20?20: rttlstring.Length) + (rttlstring.Length > 20 ? "..." : ""), ConsoleColor.Yellow, prefix: " roundtrip time limit values :", suffix: "ms");
190 196 ColorConsole.WriteLine((string.Join(",", pconfig.RoundTripTimeyCategoryLimits)).ToString(), ConsoleColor.Yellow, prefix: " roundtrip time category limit values:", suffix: "ms");
191 197 }
192   - private static void DisplayPingerHistory(List<Pinger> selectedpingers)
  198 + private static void DisplayPingerHistory(List<Pinger> selectedpingers,int firstrow,int cc)
193 199 {
  200 + if (selectedpingers == null || !selectedpingers.Any()) { return; }
  201 + var lastrow = ColorConsole.CursorTop;
  202 + ColorConsole.SetCursorPosition(cc,firstrow);
  203 + for (var i= 0; i< lastrow - firstrow;i++) { ColorConsole.WriteLine(new string(' ',100)); }
  204 + ColorConsole.SetCursorPosition(cc, firstrow);
  205 +
194 206 ColorConsole.WriteLine();
195 207 ColorConsole.WriteLine($"Pinger History:", ConsoleColor.Yellow);
196 208 var cursorleftposition = ColorConsole.CursorLeft;
... ... @@ -252,37 +264,43 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS
252 264 : pingcycle.PackagesSentCategory == Pinger.PingCycle.LostPackageCategory.Bad ? ConsoleColor.Yellow
253 265 : ConsoleColor.Red;
254 266 }
255   - private static void DisplayAllPingerStatus(XElement pingerconfigxml,List<MaintenanceToolsXmlProcessor.IPAddressParsingResult> iplist, bool suppresserroneousipaddresses=false)
  267 + private static void DisplayAllPingerStatus(XElement pingerconfigxml, List<MaintenanceToolsXmlProcessor.IPAddressParsingResult> iplist, bool suppressconsolemessages = false, bool suppresserroneousipaddresses=false)
256 268 {
257   - ColorConsole.WriteLine();
258   - ColorConsole.WriteLine($"Pinger status for the following addresses:", ConsoleColor.Yellow);
259   - foreach (var ip in iplist) { DisplayOnePingerStatus(ip, pingerconfigxml, suppresserroneousipaddresses); }
  269 + if (!suppressconsolemessages)
  270 + {
  271 + ColorConsole.WriteLine();
  272 + ColorConsole.WriteLine($"Pinger status for the following addresses:", ConsoleColor.Yellow);
  273 + }
  274 + foreach (var ip in iplist) { DisplayOnePingerStatus(ip, pingerconfigxml, suppressconsolemessages ,suppresserroneousipaddresses); }
260 275 }
261   - private static void DisplayOnePingerStatus(MaintenanceToolsXmlProcessor.IPAddressParsingResult ip, XElement pingerconfigxml,bool suppresserroneousipaddresses = false)
  276 + private static void DisplayOnePingerStatus(MaintenanceToolsXmlProcessor.IPAddressParsingResult ip, XElement pingerconfigxml, bool suppressconsolemessages = false,bool suppresserroneousipaddresses = false)
262 277 {
263 278 if (ip.GoodIP)
264 279 {
265   - ColorConsole.Write($"{ip.IP}", ConsoleColor.Green,prefix:" ");
  280 + if (!suppressconsolemessages) { ColorConsole.Write($"{ip.IP}", ConsoleColor.Green, prefix: " "); }
266 281  
267 282 var pingerlist = PingerList.Select(x => x.HostNameOrAddress).ToList();
268 283 Pinger pinger;
269 284 if (pingerlist.Contains(ip.IP.ToString()))
270 285 {
271 286 pinger = PingerList.FirstOrDefault(x => x.HostNameOrAddress == ip.IP.ToString());
272   - ColorConsole.Write($" Pinger exist.", ConsoleColor.Green);
  287 + if (!suppressconsolemessages) { ColorConsole.Write($" Pinger exist.", ConsoleColor.Green); }
273 288 }
274 289 else
275 290 {
276 291 pinger = new Pinger(ip.IP.ToString(), pingerconfigxml);
277 292 PingerList.Add(pinger);
278   - ColorConsole.Write($" Pinger created.", ConsoleColor.Green);
  293 + if (!suppressconsolemessages) { ColorConsole.Write($" Pinger created.", ConsoleColor.Green); }
279 294 }
280 295  
281   - if (pinger.Operating) { ColorConsole.Write($" Pinger running.", ConsoleColor.Green); }
282   - else { ColorConsole.Write($" Pinger still.", ConsoleColor.Green); }
283   - ColorConsole.WriteLine();
  296 + if (!suppressconsolemessages)
  297 + {
  298 + if (pinger.Operating) { ColorConsole.Write($" Pinger running.", ConsoleColor.Green); }
  299 + else { ColorConsole.Write($" Pinger still.", ConsoleColor.Green); }
  300 + ColorConsole.WriteLine();
  301 + }
284 302 }
285   - else { if (!suppresserroneousipaddresses) { ColorConsole.WriteLine(ip.ErrorMessage, ConsoleColor.Red); } }
  303 + else { if (!suppresserroneousipaddresses && !suppressconsolemessages) { ColorConsole.WriteLine(ip.ErrorMessage, ConsoleColor.Red); } }
286 304 }
287 305 #endregion TcpIpTester
288 306  
... ...
Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs
... ... @@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
32 32 // You can specify all the values or you can default the Build and Revision Numbers
33 33 // by using the '*' as shown below:
34 34 // [assembly: AssemblyVersion("1.0.*")]
35   -[assembly: AssemblyVersion("1.8.1.0")]
36   -[assembly: AssemblyFileVersion("1.8.1.0")]
  35 +[assembly: AssemblyVersion("1.8.2.0")]
  36 +[assembly: AssemblyFileVersion("1.8.2.0")]
... ...