Skip to content

Commit 22bafef

Browse files
Merge pull request #2 from ThatOneCodeDev/Development
implemented alert tones for high latency and server outages
2 parents 36e151b + ae4511f commit 22bafef

File tree

7 files changed

+32
-1
lines changed

7 files changed

+32
-1
lines changed
Binary file not shown.
Binary file not shown.
144 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

Src/.vs/ServiceMon/v17/.futdcache.v2

0 Bytes
Binary file not shown.

Src/ServiceMon/Program.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,52 @@ static async Task CheckServerStatus(Server server)
8989

9090
if (reply.Status == IPStatus.Success)
9191
{
92-
Console.ForegroundColor = GetLatencyColor(reply.RoundtripTime);
92+
var clr = GetLatencyColor(reply.RoundtripTime);
93+
Console.ForegroundColor = clr;
9394
Console.Write($"Server: {server.Name} is operational.");
9495
Console.WriteLine();
9596
Console.WriteLine($"Latency: {reply.RoundtripTime} ms");
97+
if (clr != ConsoleColor.Green)
98+
{
99+
Console.Beep(500, 500);
100+
await Task.Delay(550);
101+
Console.Beep(500, 500);
102+
await Task.Delay(550);
103+
Console.Beep(500, 500);
104+
await Task.Delay(550);
105+
Console.Beep(500, 500);
106+
}
96107
}
97108
else
98109
{
99110
Console.ForegroundColor = ConsoleColor.Red;
100111
Console.WriteLine($"Server: {server.Name} is down.");
112+
if (OperatingSystem.IsWindows())
113+
{
114+
Console.Beep(500, 500);
115+
await Task.Delay(550);
116+
Console.Beep(500, 500);
117+
await Task.Delay(550);
118+
Console.Beep(500, 500);
119+
await Task.Delay(550);
120+
Console.Beep(500, 500);
121+
}
101122
}
102123
}
103124
catch (PingException ex)
104125
{
105126
Console.ForegroundColor = ConsoleColor.Red;
106127
Console.WriteLine($"Error pinging server '{server.Name}': {ex.Message}");
128+
if (OperatingSystem.IsWindows())
129+
{
130+
Console.Beep(500, 500);
131+
await Task.Delay(550);
132+
Console.Beep(500, 500);
133+
await Task.Delay(550);
134+
Console.Beep(500, 500);
135+
await Task.Delay(550);
136+
Console.Beep(500, 500);
137+
}
107138
}
108139
}
109140

0 commit comments

Comments
 (0)