Remove ping stats from server notifier

This commit is contained in:
pizzaboxer 2023-03-13 19:14:24 +00:00
parent f8dd388f88
commit add07a1c71
2 changed files with 4 additions and 17 deletions

View File

@ -39,25 +39,12 @@ namespace Bloxstrap.Integrations
if (String.IsNullOrEmpty(locationCountry)) if (String.IsNullOrEmpty(locationCountry))
message = "Location: N/A"; message = "Location: N/A";
else if (locationCity == locationRegion) else if (locationCity == locationRegion)
message = $"Location: {locationRegion}, {locationCountry}\n"; message = $"Location: {locationRegion}, {locationCountry}";
else else
message = $"Location: {locationCity}, {locationRegion}, {locationCountry}\n"; message = $"Location: {locationCity}, {locationRegion}, {locationCountry}";
// UDMUX protected servers don't respond to ICMP packets and so the ping fails
// we could probably get around this by doing a UDP latency test but ehhhhhhhh
if (_activityWatcher.ActivityMachineUDMUX) if (_activityWatcher.ActivityMachineUDMUX)
{ message += "\nServer is UDMUX protected";
message += "Latency: N/A (Server is UDMUX protected)";
}
else
{
PingReply ping = await new Ping().SendPingAsync(machineAddress);
if (ping.Status == IPStatus.Success)
message += $"Latency: ~{ping.RoundtripTime}ms";
else
message += $"Latency: N/A (Code {ping.Status})";
}
App.Logger.WriteLine($"[ServerNotifier::Notify] {message.ReplaceLineEndings("\\n")}"); App.Logger.WriteLine($"[ServerNotifier::Notify] {message.ReplaceLineEndings("\\n")}");

View File

@ -120,7 +120,7 @@
<ui:CardControl.Header> <ui:CardControl.Header>
<StackPanel> <StackPanel>
<TextBlock FontSize="14" Text="Show server details of current game" /> <TextBlock FontSize="14" Text="Show server details of current game" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Be notified of useful server details (e.g. location and ping) whenever you join a game." Foreground="{DynamicResource TextFillColorTertiaryBrush}" /> <TextBlock Margin="0,2,0,0" FontSize="12" Text="Be notified of useful server details whenever you join a game." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel> </StackPanel>
</ui:CardControl.Header> </ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding ShowServerDetailsEnabled, Mode=TwoWay}" /> <ui:ToggleSwitch IsChecked="{Binding ShowServerDetailsEnabled, Mode=TwoWay}" />