Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 7.9.0.2310 #502

Merged
merged 17 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions InternetTest/InternetTest/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,52 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Themes/Light.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="CheckButton" TargetType="{x:Type RadioButton}">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<ContentPresenter
x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Background" Value="{Binding Source={StaticResource AccentColor}}" />
<Setter TargetName="border" Property="BorderBrush" Value="Transparent" />
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="White" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="border" Property="Background" Value="{Binding Source={StaticResource AccentColor}}" />
<Setter TargetName="border" Property="BorderBrush" Value="Transparent" />
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="border" Property="Background" Value="{Binding Source={StaticResource AccentColor}}" />
<Setter TargetName="border" Property="BorderBrush" Value="Transparent" />
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="White" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Background" Value="Transparent" />
<Setter TargetName="border" Property="BorderBrush" Value="Transparent" />
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{Binding Source={StaticResource Gray}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PrimaryButton" TargetType="{x:Type Button}">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
Expand Down
27 changes: 27 additions & 0 deletions InternetTest/InternetTest/Classes/AdapterInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
public long UnicastPacketsReceived { get; set; }
public long UnicastPacketsSent { get; set; }

public AdapterInfo(NetworkInterface adapter)

Check warning on line 56 in InternetTest/InternetTest/Classes/AdapterInfo.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'IpVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 56 in InternetTest/InternetTest/Classes/AdapterInfo.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'IpVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 56 in InternetTest/InternetTest/Classes/AdapterInfo.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'IpVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
{
IPInterfaceProperties properties = adapter.GetIPProperties();
IPInterfaceStatistics statistics = adapter.GetIPStatistics();
Expand Down Expand Up @@ -86,7 +86,7 @@
}
if (adapter.Supports(NetworkInterfaceComponent.IPv6))
{
if (IpVersion.Length > 0)

Check warning on line 89 in InternetTest/InternetTest/Classes/AdapterInfo.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 89 in InternetTest/InternetTest/Classes/AdapterInfo.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 89 in InternetTest/InternetTest/Classes/AdapterInfo.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
{
IpVersion += ", ";
}
Expand Down Expand Up @@ -121,6 +121,33 @@
$"{UnicastPacketsSent}";
}

public string ToLongFormattedString()
{
return $"{Properties.Resources.Name}: {Name}\n" +
$"{Properties.Resources.InterfaceType}: {Global.GetInterfaceTypeName(NetworkInterfaceType)}\n" +
$"{Properties.Resources.Status}: {Status switch { OperationalStatus.Up => Properties.Resources.ConnectedS, OperationalStatus.Down => Properties.Resources.Disconnected, _ => Status.ToString() }}\n" +
$"{Properties.Resources.IpVersion}: {IpVersion}\n" +
$"{Properties.Resources.DNSSuffix}: {DnsSuffix}\n" +
$"{Properties.Resources.MTU}: {Mtu}\n" +
$"{Properties.Resources.DnsEnabled}: {BoolToString(DnsEnabled)}\n" +
$"{Properties.Resources.DnsDynamicConfigured}: {BoolToString(IsDynamicDnsEnabled)}\n" +
$"{Properties.Resources.ReceiveOnly}: {BoolToString(IsReceiveOnly)}\n" +
$"{Properties.Resources.Multicast}: {BoolToString(SupportsMulticast)}\n" +
$"{Properties.Resources.Speed}: {Global.GetStorageUnit(Speed).Item2:0.00} {Global.UnitToString(Global.GetStorageUnit(Speed).Item1)}/s\n" +
$"{Properties.Resources.TotalBytesReceived}: {Global.GetStorageUnit(BytesReceived).Item2:0.00} {Global.UnitToString(Global.GetStorageUnit(BytesReceived).Item1)}\n" +
$"{Properties.Resources.TotalBytesSent}: {Global.GetStorageUnit(BytesSent).Item2:0.00} {Global.UnitToString(Global.GetStorageUnit(BytesSent).Item1)}\n" +
$"{Properties.Resources.IncomingPacketsDiscarded}: {IncomingPacketsDiscarded}\n" +
$"{Properties.Resources.IncomingPacketsWithErrors}: {IncomingPacketsWithErrors}\n" +
$"{Properties.Resources.IncomingUnknownProtocolPackets}: {IncomingUnknownProtocolPackets}\n" +
$"{Properties.Resources.NonUnicastPacketsReceived}: {NonUnicastPacketsReceived}\n" +
$"{Properties.Resources.NonUnicastPacketsSent}: {NonUnicastPacketsSent}\n" +
$"{Properties.Resources.OutgoingPacketsDiscarded}: {OutgoingPacketsDiscarded}\n" +
$"{Properties.Resources.OutgoingPacketsWithErrors}: {OutgoingPacketsWithErrors}\n" +
$"{Properties.Resources.OutputQueueLength}: {OutputQueueLength}\n" +
$"{Properties.Resources.UnicastPacketsReceived}: {UnicastPacketsReceived}\n" +
$"{Properties.Resources.UnicastPacketsSent}: {UnicastPacketsSent}";
}

private string BoolToString(bool b) => b ? Properties.Resources.Yes : Properties.Resources.No;
}
}
4 changes: 2 additions & 2 deletions InternetTest/InternetTest/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
{

#if NIGHTLY
private static DateTime Date => System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetEntryAssembly().Location);

Check warning on line 49 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

public static string Version => $"7.8.1.2309-nightly{Date:yyMM.dd@HHmm}";
public static string Version => $"7.9.0.2310-nightly{Date:yyMM.dd@HHmm}";

#else
public static string Version => "7.8.1.2309";
public static string Version => "7.9.0.2310";
#endif
public static string LastVersionLink => "https://raw.githubusercontent.com/Leo-Corporation/LeoCorp-Docs/master/Liens/Update%20System/InternetTest/7.0/Version.txt";
public static bool IsConfidentialModeEnabled { get; set; } = false;
Expand Down Expand Up @@ -146,9 +146,9 @@
{ AppPages.Ping, synethiaConfig.PingPageInfo.Score },
{ AppPages.IPConfig, synethiaConfig.IPConfigPageInfo.Score },
{ AppPages.WiFiPasswords, synethiaConfig.WiFiPasswordsPageInfo.Score },
{ AppPages.DnsTool, synethiaConfig.DnsPageInfo.Score },

Check warning on line 149 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 149 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
{ AppPages.TraceRoute, synethiaConfig.TraceRoutePageInfo.Score },

Check warning on line 150 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 150 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
{ AppPages.WiFiNetworks, synethiaConfig.WiFiNetworksPageInfo.Score },

Check warning on line 151 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 151 in InternetTest/InternetTest/Classes/Global.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
};

var sorted = appScores.OrderByDescending(x => x.Value);
Expand Down
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
TraceRouteMaxHops = 30;
TraceRouteMaxTimeOut = 5000;
MainWindowSize = (950, 600);
LaunchIpLocationOnStart = true;
}

public Themes Theme { get; set; }
Expand All @@ -72,6 +73,7 @@
public int? TraceRouteMaxHops { get; set; }
public int? TraceRouteMaxTimeOut { get; set; }
public (double, double)? MainWindowSize { get; set; }
public bool? LaunchIpLocationOnStart { get; set; }
}

public static class SettingsManager
Expand Down Expand Up @@ -111,6 +113,7 @@
settings.TraceRouteMaxHops ??= 30;
settings.TraceRouteMaxTimeOut ??= 5000;
settings.MainWindowSize ??= (950, 600);
settings.LaunchIpLocationOnStart ??= true;

return settings;
}
Expand Down Expand Up @@ -160,7 +163,7 @@
XmlSerializer xmlSerializer = new(typeof(Settings)); // XML Serializer
StreamReader streamReader = new(path); // Where the file is going to be read

Global.Settings = (Settings)xmlSerializer.Deserialize(streamReader); // Read

Check warning on line 166 in InternetTest/InternetTest/Classes/Settings.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 166 in InternetTest/InternetTest/Classes/Settings.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

streamReader.Dispose();
Save(); // Save
Expand Down
6 changes: 3 additions & 3 deletions InternetTest/InternetTest/InternetTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>True</UseWindowsForms>
<Version>7.8.1.2309</Version>
<Version>7.9.0.2310</Version>
<Copyright>© 2023</Copyright>
<Company>Léo Corporation</Company>
<Description>Taking you to another level. InternetTest can locate IP addresses, send ping request, recover your WiFi passwords and more!</Description>
Expand Down Expand Up @@ -37,8 +37,8 @@
<ItemGroup>
<PackageReference Include="DnsClient" Version="1.7.0" />
<PackageReference Include="ManagedNativeWifi" Version="2.5.0" />
<PackageReference Include="PeyrSharp.Core" Version="1.9.0.2309" />
<PackageReference Include="PeyrSharp.Env" Version="1.9.0.2309" />
<PackageReference Include="PeyrSharp.Core" Version="1.10.0.2310" />
<PackageReference Include="PeyrSharp.Env" Version="1.10.0.2310" />
<PackageReference Include="Whois" Version="3.0.1" />
</ItemGroup>

Expand Down
7 changes: 6 additions & 1 deletion InternetTest/InternetTest/Pages/DnsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
Expand Down Expand Up @@ -191,7 +192,11 @@
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.DNSInfo}" />
</StackPanel>
<StackPanel x:Name="RecordDisplayer" Grid.Row="5" />
<WrapPanel
x:Name="FiltersDisplayer"
Grid.Row="5"
Orientation="Horizontal" />
<StackPanel x:Name="RecordDisplayer" Grid.Row="6" />
</Grid>

</Page>
49 changes: 48 additions & 1 deletion InternetTest/InternetTest/Pages/DnsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Windows;
using System.Windows.Controls;
using Whois;
using System.Collections.Generic;
using System.Windows.Media;
using System.Windows.Input;

namespace InternetTest.Pages;
/// <summary>
Expand Down Expand Up @@ -119,6 +122,8 @@ private async void GetDnsInfo(string website)
}
catch { }

List<string> availableTypes = new();
FiltersDisplayer.Children.Clear();
try
{
// Get DNS records
Expand All @@ -127,6 +132,15 @@ private async void GetDnsInfo(string website)
foreach (var record in result.AllRecords)
{
RecordDisplayer.Children.Add(new DnsRecordItem(record.RecordType.ToString(), record.ToString()));
if (!availableTypes.Contains(record.RecordType.ToString()))
availableTypes.Add(record.RecordType.ToString());
}

availableTypes.Sort();
availableTypes.Insert(0, "ANY");
for (int i = 0; i < availableTypes.Count; i++)
{
FiltersDisplayer.Children.Add(CreateFilterButton(availableTypes[i]));
}
}
catch { }
Expand All @@ -151,6 +165,39 @@ private async void GetDnsInfo(string website)
catch { }
}

private RadioButton CreateFilterButton(string recordType)
{
RadioButton filterBtn = new()
{
Margin = new(5),
Padding = new(5),
BorderThickness = new(0),
Content = recordType,
Style = (Style)FindResource("CheckButton"),
Foreground = new SolidColorBrush { Color = Global.GetColorFromResource("AccentColor") },
Background = new SolidColorBrush { Color = Global.GetColorFromResource("LightAccentColor") },
Cursor = Cursors.Hand,
FontWeight = FontWeights.Bold,
GroupName = "Filters",
IsChecked = recordType == "ANY"
};
filterBtn.Click += (o, e) => { filterBtn.IsChecked = true; Filter(recordType); };
return filterBtn;
}

private void Filter(string query)
{
foreach (DnsRecordItem item in RecordDisplayer.Children)
{
if (query == "ANY")
{
item.Visibility = Visibility.Visible;
continue;
}
item.Visibility = query == item.Type ? Visibility.Visible : Visibility.Collapsed;
}
}

private void DismissBtn_Click(object sender, RoutedEventArgs e)
{
SiteTxt.Text = string.Empty;
Expand All @@ -159,7 +206,7 @@ private void DismissBtn_Click(object sender, RoutedEventArgs e)
internal void GetDnsInfoBtn_Click(object sender, RoutedEventArgs e)
{
GetDnsInfo(SiteTxt.Text);

// Increment the interaction count of the ActionInfo in Global.SynethiaConfig
Global.SynethiaConfig.ActionInfos.First(a => a.Action == Enums.AppActions.GetDnsInfo).UsageCount++;
}
Expand Down
2 changes: 1 addition & 1 deletion InternetTest/InternetTest/Pages/LocateIpPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private async void InitUI()
TitleTxt.Text = $"{Properties.Resources.IPTools} > {Properties.Resources.LocateIP}";
try
{
if (await Internet.IsAvailableAsync())
if (Global.Settings.LaunchIpLocationOnStart ?? true && await Internet.IsAvailableAsync())
{
LocateIP(""); // Get the current IP of the user
}
Expand Down
2 changes: 1 addition & 1 deletion InternetTest/InternetTest/Pages/MyIpPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private async void InitUI()
{
try
{
if (await Internet.IsAvailableAsync())
if (Global.Settings.LaunchIpLocationOnStart ?? true && await Internet.IsAvailableAsync())
{
GetMyIP(); // Locate the current IP
}
Expand Down
12 changes: 11 additions & 1 deletion InternetTest/InternetTest/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="SettingsPage"
d:Background="White"
d:DesignHeight="450"
d:DesignHeight="1450"
d:DesignWidth="800"
FontFamily="../Fonts/#Hauora"
Foreground="{Binding Source={StaticResource Foreground1}}"
Expand Down Expand Up @@ -467,6 +467,16 @@
Foreground="{Binding Source={StaticResource Foreground1}}"
Style="{DynamicResource CheckBoxStyle1}"
Unchecked="TestOnStartChk_Checked" />
<CheckBox
x:Name="LocateIpOnStartChk"
Margin="10 0 0 5"
VerticalContentAlignment="Center"
BorderThickness="2"
Checked="LocateIpOnStartChk_Checked"
Content="{x:Static lang:Resources.LocateMyIpOnStart}"
Foreground="{Binding Source={StaticResource Foreground1}}"
Style="{DynamicResource CheckBoxStyle1}"
Unchecked="LocateIpOnStartChk_Checked" />
<CheckBox
x:Name="ToggleConfModeOnStartChk"
Margin="10 0 0 5"
Expand Down
7 changes: 7 additions & 0 deletions InternetTest/InternetTest/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private async void InitUI()
// On Start section
UpdateOnStartChk.IsChecked = Global.Settings.CheckUpdateOnStart;
TestOnStartChk.IsChecked = Global.Settings.TestOnStart;
LocateIpOnStartChk.IsChecked = Global.Settings.LaunchIpLocationOnStart ?? true;
ToggleConfModeOnStartChk.IsChecked = Global.Settings.ToggleConfidentialMode;
RememberPinOnStartChk.IsChecked = Global.Settings.RememberPinnedState;
PageComboBox.SelectedIndex = (int)Global.Settings.DefaultPage;
Expand Down Expand Up @@ -420,4 +421,10 @@ private void TimeOutApplyBtn_Click(object sender, RoutedEventArgs e)
Global.Settings.TraceRouteMaxTimeOut = int.Parse(TimeOutTxt.Text);
SettingsManager.Save();
}

private void LocateIpOnStartChk_Checked(object sender, RoutedEventArgs e)
{
Global.Settings.LaunchIpLocationOnStart = LocateIpOnStartChk.IsChecked;
SettingsManager.Save();
}
}
48 changes: 48 additions & 0 deletions InternetTest/InternetTest/Pages/WiFiNetworksPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,54 @@
Text="{x:Static lang:Resources.Adapters}" />
</Grid>
</RadioButton>
<Border
x:Name="SearchBorder"
Grid.Row="1"
Width="200"
Margin="10 3 3 3"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Background="{Binding Source={StaticResource CardBackground}}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{Binding Source={StaticResource AccentColor}}" />
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="SearchTxt"
Margin="5 0"
Padding="1"
VerticalAlignment="Center"
d:Text="123.54.132.56"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{Binding Source={StaticResource DarkGray}}"
TextChanged="SearchTxt_TextChanged" />
<Button
x:Name="DismissBtn"
Grid.Column="1"
Margin="2"
Padding="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Click="DismissBtn_Click"
Content="&#xF36A;"
FontFamily="../Fonts/#FluentSystemIcons-Regular"
Foreground="{Binding Source={StaticResource Foreground1}}"
Style="{DynamicResource ToolButton}" />
</Grid>
</Border>
</StackPanel>
<StackPanel
Grid.Row="1"
Expand Down
Loading
Loading