From 62eca1c4743f4c8a133f7da89cef21816227f3d4 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:50:41 +0100 Subject: [PATCH] Improve consistency of notification messages --- HyperbolicDownloaderApi/Commands/HostCommands.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/HyperbolicDownloaderApi/Commands/HostCommands.cs b/HyperbolicDownloaderApi/Commands/HostCommands.cs index 2a66bd3..c38514f 100644 --- a/HyperbolicDownloaderApi/Commands/HostCommands.cs +++ b/HyperbolicDownloaderApi/Commands/HostCommands.cs @@ -19,7 +19,16 @@ public class HostCommands(HostsManager hostsManager) BroadcastClient.Send(ApiConfiguration.BroadcastPort, ApiConfiguration.PrivatePort.ToString()); Thread.Sleep(3000); - ApiManager.SendNotificationMessageNewLine($"Found {hostsManager.Count - hostsCountBefore} host(s)", NotificationMessageType.Info); + int newHostsCount = hostsManager.Count - hostsCountBefore; + + if (newHostsCount > 0) + { + ApiManager.SendNotificationMessageNewLine($"Found {newHostsCount} host(s).", NotificationMessageType.Info); + } + else + { + ApiManager.SendNotificationMessageNewLine($"No new hosts added.", NotificationMessageType.Warning); + } } public void CheckActiveHosts(string _) @@ -43,7 +52,7 @@ public class HostCommands(HostsManager hostsManager) if (hosts.Count == 0) { - ApiManager.SendNotificationMessageNewLine("No known hosts", NotificationMessageType.Warning); + ApiManager.SendNotificationMessageNewLine("No known hosts.", NotificationMessageType.Warning); return; } @@ -102,7 +111,7 @@ public class HostCommands(HostsManager hostsManager) if (!hostsManager.Contains(hostToRemove)) { - ApiManager.SendNotificationMessageNewLine("Host not in list", NotificationMessageType.Error); + ApiManager.SendNotificationMessageNewLine("Host not in list!", NotificationMessageType.Error); return; }