Skip to content

Commit e36cd81

Browse files
authored
Feature: GeoIP for Traceroute (BornToBeRoot#2477)
* Feature: GeoIP for Traceroute * Feature: Traceroute > IP Geolocation * Feature: Update welcome dialog * Fix: BornToBeRoot#2480 * Chore: Code cleanup * Docs: Traceroute GeoIP * Chore: Some refactoring * Feature: Traceroute IP Geolocation / Code cleanup * Chore: Refactor ExportManager * Feature: Copy & Export IP Geo data from Traceroute
1 parent f03c663 commit e36cd81

169 files changed

Lines changed: 3808 additions & 4255 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Scripts/PreBuildEventCommandLine.ps1

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,38 @@
33

44
param(
55
[Parameter(
6-
Position=0,
7-
Mandatory=$true)]
6+
Position = 0,
7+
Mandatory = $true)]
88
[String]$OutPath
99
)
1010

1111
# Fix wrong path (if there is no blank in the path, a quote will be added to the end...)
12-
if(-not($OutPath.StartsWith('"')))
13-
{
12+
if (-not($OutPath.StartsWith('"'))) {
1413
$OutPath = $OutPath.TrimEnd('"')
1514
}
1615

1716
# NetBeauty will move all dependencies to the lib folder
1817
$OutPath = $OutPath + "\lib"
1918

2019
# Create folder
21-
New-Item -ItemType Directory -Path $OutPath
20+
if (-not(Test-Path -Path $OutPath -PathType Container)) {
21+
New-Item -ItemType Directory -Path $OutPath
22+
}
2223

2324
################################################
2425
### Generate MSTSCLib.dll and AxMSTSCLib.dll ###
2526
################################################
2627

2728
# Test if files are already there...
28-
if((Test-Path -Path "$OutPath\MSTSCLib.dll") -and (Test-Path -Path "$OutPath\AxMSTSCLib.dll"))
29-
{
29+
if ((Test-Path -Path "$OutPath\MSTSCLib.dll") -and (Test-Path -Path "$OutPath\AxMSTSCLib.dll")) {
3030
Write-Host "MSTSCLib.dll and AxMSTSCLib.dll exist! Continue..."
3131
return
3232
}
3333

3434
# Detect x86 or x64
3535
$ProgramFiles_Path = ${Env:ProgramFiles(x86)}
3636

37-
if([String]::IsNullOrEmpty($ProgramFiles_Path))
38-
{
37+
if ([String]::IsNullOrEmpty($ProgramFiles_Path)) {
3938
$ProgramFiles_Path = $Env:ProgramFiles
4039
}
4140

@@ -44,8 +43,7 @@ $AximpPath = ((Get-ChildItem -Path "$ProgramFiles_Path\Microsoft SDKs\Windows" -
4443
$IldasmPath = ((Get-ChildItem -Path "$ProgramFiles_Path\Microsoft SDKs\Windows" -Recurse -Filter "ildasm.exe" -File) | Sort-Object CreationTime | Select-Object -First 1).FullName
4544
$IlasmPath = ((Get-ChildItem -Path "$($Env:windir)\Microsoft.NET\Framework\" -Recurse -Filter "ilasm.exe" -File) | Sort-Object CreationTime | Select-Object -First 1).FullName
4645

47-
if([String]::IsNullOrEmpty($AximpPath) -or [String]::IsNullOrEmpty($IldasmPath) -or [String]::IsNullOrEmpty($IlasmPath))
48-
{
46+
if ([String]::IsNullOrEmpty($AximpPath) -or [String]::IsNullOrEmpty($IldasmPath) -or [String]::IsNullOrEmpty($IlasmPath)) {
4947
Write-Host "Could not find sdk tools:`naximp.exe`t=>`t$AximpPath`nildasm.exe`t=>`t$IldasmPath`nilasm.exe`t=>`t$IlasmPath"
5048
return
5149
}

Source/NETworkManager.Converters/AccentToStringConverter.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Globalization;
33
using System.Windows.Data;
4-
using NETworkManager.Localization.Translators;
4+
using NETworkManager.Localization;
55
using NETworkManager.Models.Appearance;
66

77
namespace NETworkManager.Converters;
@@ -11,7 +11,6 @@ namespace NETworkManager.Converters;
1111
/// </summary>
1212
public sealed class AccentToStringConverter : IValueConverter
1313
{
14-
1514
/// <summary>
1615
/// Convert <see cref="AccentColorInfo"/> to translated <see cref="string"/>.
1716
/// </summary>
@@ -22,10 +21,7 @@ public sealed class AccentToStringConverter : IValueConverter
2221
/// <returns>Translated <see cref="AccentColorInfo"/>.</returns>
2322
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2423
{
25-
if (!(value is string accent))
26-
return "-/-";
27-
28-
return AccentTranslator.GetInstance().Translate(accent);
24+
return value is not string accent ? "-/-" : ResourceTranslator.Translate(ResourceIdentifier.Accent, accent);
2925
}
3026

3127
/// <summary>

Source/NETworkManager.Converters/ApplicationNameToIconConverter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ public sealed class ApplicationNameToIconConverter : IValueConverter
2121
/// <returns>Icon (cref="Canvas"/>).</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
if (value is not ApplicationName name)
25-
return null;
26-
27-
return ApplicationManager.GetIcon(name);
24+
return value is not ApplicationName name ? null : ApplicationManager.GetIcon(name);
2825
}
2926

3027
/// <summary>

Source/NETworkManager.Converters/ApplicationNameToTranslatedStringConverter.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using NETworkManager.Localization.Translators;
2-
using NETworkManager.Models;
1+
using NETworkManager.Models;
32
using System;
43
using System.Globalization;
54
using System.Windows.Data;
5+
using NETworkManager.Localization;
66

77
namespace NETworkManager.Converters;
88

@@ -21,10 +21,9 @@ public sealed class ApplicationNameToTranslatedStringConverter : IValueConverter
2121
/// <returns>Translated <see cref="ApplicationName"/>.</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
if (!(value is ApplicationName name))
25-
return "-/-";
26-
27-
return ApplicationNameTranslator.GetInstance().Translate(name);
24+
return value is not ApplicationName name
25+
? "-/-"
26+
: ResourceTranslator.Translate(ResourceIdentifier.ApplicationName, name);
2827
}
2928

3029
/// <summary>

Source/NETworkManager.Converters/AutoRefreshTimeToStringConverter.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Globalization;
33
using System.Windows.Data;
4-
using NETworkManager.Localization.Translators;
4+
using NETworkManager.Localization;
55
using NETworkManager.Utilities;
66

77
namespace NETworkManager.Converters;
@@ -21,10 +21,9 @@ public sealed class AutoRefreshTimeToStringConverter : IValueConverter
2121
/// <returns>Translated <see cref="TimeUnit"/>.</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
24-
if (!(value is TimeUnit timeUnit))
25-
return "-/-";
26-
27-
return TimeUnitTranslator.GetInstance().Translate(timeUnit);
24+
return value is not TimeUnit timeUnit
25+
? "-/-"
26+
: ResourceTranslator.Translate(ResourceIdentifier.TimeUnit, timeUnit);
2827
}
2928

3029
/// <summary>

Source/NETworkManager.Converters/BooleanReverseToVisibilityCollapsedConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public sealed class BooleanReverseToVisibilityCollapsedConverter : IValueConvert
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
return value is bool visible && visible ? Visibility.Collapsed : Visibility.Visible;
12+
return value is true ? Visibility.Collapsed : Visibility.Visible;
1313
}
1414

1515
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Source/NETworkManager.Converters/BooleanReverseToVisibilityHiddenConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public sealed class BooleanReverseToVisibilityHiddenConverter : IValueConverter
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
return value is bool visible && visible ? Visibility.Hidden : Visibility.Visible;
12+
return value is true ? Visibility.Hidden : Visibility.Visible;
1313
}
1414

1515
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Source/NETworkManager.Converters/BooleanToVisibilityCollapsedConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public sealed class BooleanToVisibilityCollapsedConverter : IValueConverter
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
return value is bool visible && visible ? Visibility.Visible : Visibility.Collapsed;
12+
return value is true ? Visibility.Visible : Visibility.Collapsed;
1313
}
1414

1515
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Source/NETworkManager.Converters/BooleanToVisibilityHiddenConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public sealed class BooleanToVisibilityHiddenConverter : IValueConverter
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
return value is bool visible && visible ? Visibility.Visible : Visibility.Hidden;
12+
return value is true ? Visibility.Visible : Visibility.Hidden;
1313
}
1414

1515
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

Source/NETworkManager.Converters/Bytes1000ToSpeedConverter.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ namespace NETworkManager.Converters;
66

77
public sealed class Bytes1000ToSpeedConverter : IValueConverter
88
{
9-
private readonly string[] _sizes = { "Bit/s", "KBit/s", "MBit/s", "GBit/s", "Tbit/s" };
9+
private readonly string[] _sizes = { "Bit/s", "KBit/s", "MBit/s", "GBit/s", "TBit/s" };
1010

1111
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1212
{
1313
if (value == null)
1414
return "-/-";
1515

16-
double.TryParse(value.ToString(), out var bits);
17-
16+
if (!double.TryParse(value.ToString(), out var bits))
17+
return "-/-";
18+
1819
var sizeCount = 0;
1920

2021
while (bits >= 1000 && ++sizeCount < _sizes.Length)

0 commit comments

Comments
 (0)