Skip to content

Commit

Permalink
Merge pull request #586 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 8.4.0.2407
  • Loading branch information
lpeyr authored Jul 9, 2024
2 parents 61fcfaf + 644c948 commit 8112f39
Show file tree
Hide file tree
Showing 14 changed files with 249 additions and 33 deletions.
4 changes: 2 additions & 2 deletions InternetTest/InternetTest/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public static class Global
#if NIGHTLY
private static DateTime Date => System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetEntryAssembly().Location);

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

#else
public static string Version => "8.3.1.2405";
public static string Version => "8.4.0.2407";
#endif
public static string LastVersionLink => "https://raw.githubusercontent.com/Leo-Corporation/LeoCorp-Docs/master/Liens/Update%20System/InternetTest/7.0/Version.txt";
internal static string SynethiaPath => $@"{FileSys.AppDataPath}\Léo Corporation\InternetTest Pro\NewSynethiaConfig.json";
Expand Down
10 changes: 5 additions & 5 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>8.3.1.2405</Version>
<Version>8.4.0.2407</Version>
<Copyright>© 2024</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 @@ -36,12 +36,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="DnsClient" Version="1.7.0" />
<PackageReference Include="ManagedNativeWifi" Version="2.5.0" />
<PackageReference Include="DnsClient" Version="1.8.0" />
<PackageReference Include="ManagedNativeWifi" Version="2.6.0" />
<PackageReference Include="PeyrSharp.Core" Version="2.1.0.2312" />
<PackageReference Include="PeyrSharp.Env" Version="2.1.0.2312" />
<PackageReference Include="QRCoder" Version="1.5.1" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="RestSharp" Version="111.3.0" />
<PackageReference Include="Synethia" Version="1.1.1.2302" />
<PackageReference Include="Whois" Version="3.0.1" />
</ItemGroup>
Expand Down
35 changes: 30 additions & 5 deletions InternetTest/InternetTest/Pages/DnsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,36 @@
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.DNSInfo}" />
</StackPanel>
<WrapPanel
x:Name="FiltersDisplayer"
Grid.Row="5"
Margin="5 0 0 0"
Orientation="Horizontal" />
<Grid Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<WrapPanel
x:Name="FiltersDisplayer"
Margin="5 0 0 0"
Orientation="Horizontal" />
<Button
x:Name="SaveCsvBtn"
Grid.Column="1"
Margin="5 0"
Padding="5 2"
VerticalAlignment="Center"
Background="{DynamicResource LightAccent}"
BorderThickness="0"
Click="SaveCsvBtn_Click"
Content="&#xF151;"
Cursor="Hand"
FontFamily="../Fonts/#FluentSystemIcons-Regular"
FontWeight="ExtraBold"
Foreground="{DynamicResource Accent}"
Style="{DynamicResource PrimaryButton}"
Visibility="Collapsed">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.ExportToCSV}" />
</Button.ToolTip>
</Button>
</Grid>
<StackPanel x:Name="RecordDisplayer" Grid.Row="6" />
</Grid>

Expand Down
23 changes: 23 additions & 0 deletions InternetTest/InternetTest/Pages/DnsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using DnsClient;
using InternetTest.Classes;
using InternetTest.UserControls;
using Microsoft.Win32;
using Synethia;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Windows;
Expand Down Expand Up @@ -57,8 +59,10 @@ private void InitUI()
DetailsGrid.Visibility = Visibility.Collapsed;
}

string csvFile = "";
private async void GetDnsInfo(string website)
{
csvFile = "Type,Value\n";
try
{
RecordDisplayer.Children.Clear();
Expand Down Expand Up @@ -87,6 +91,7 @@ private async void GetDnsInfo(string website)
foreach (var record in result.AllRecords)
{
RecordDisplayer.Children.Add(new DnsRecordItem(record.RecordType.ToString(), record.ToString()));
csvFile += $"{record.RecordType},{record}\n";
if (!availableTypes.Contains(record.RecordType.ToString()))
availableTypes.Add(record.RecordType.ToString());
}
Expand Down Expand Up @@ -118,6 +123,8 @@ private async void GetDnsInfo(string website)
RegistrantTxt.Text = regInfo;
}
catch { }

SaveCsvBtn.Visibility = (FiltersDisplayer.Children.Count > 0) ? Visibility.Visible : Visibility.Collapsed;
}

private RadioButton CreateFilterButton(string recordType)
Expand Down Expand Up @@ -183,4 +190,20 @@ private void SiteTxt_TextChanged(object sender, TextChangedEventArgs e)
{
DismissBtn.Visibility = SiteTxt.Text.Length > 0 ? Visibility.Visible : Visibility.Collapsed;
}

private void SaveCsvBtn_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog saveFileDialog = new()
{
FileName = $"{SiteTxt.Text}.csv",
Filter = "CSV|*.csv",
Title = Properties.Resources.ExportToCSV
}; // Create file dialog

if (saveFileDialog.ShowDialog() ?? true)
{
using StreamWriter outputFile = new(saveFileDialog.FileName);
outputFile.Write(csvFile);
}
}
}
72 changes: 65 additions & 7 deletions InternetTest/InternetTest/Pages/PingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@
FontWeight="ExtraBold"
Foreground="{DynamicResource WindowButtonsHoverForeground1}"
Style="{DynamicResource PrimaryButton}" />
<Button
x:Name="OptionsBtn"
Margin="5 0"
Padding="5 4"
VerticalAlignment="Center"
Background="{DynamicResource LightAccent}"
BorderThickness="0"
Click="OptionsBtn_Click"
Content="&#xF6AA;"
Cursor="Hand"
FontFamily="../Fonts/#FluentSystemIcons-Regular"
FontWeight="ExtraBold"
Foreground="{DynamicResource Accent}"
Style="{DynamicResource PrimaryButton}">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.Save}" />
</Button.ToolTip>
</Button>
</StackPanel>
<Border
Width="300"
Expand Down Expand Up @@ -158,7 +176,7 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>
Expand Down Expand Up @@ -203,7 +221,7 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>
Expand Down Expand Up @@ -248,7 +266,7 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>
Expand Down Expand Up @@ -292,7 +310,7 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>
Expand Down Expand Up @@ -337,7 +355,7 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>
Expand Down Expand Up @@ -382,7 +400,7 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>
Expand Down Expand Up @@ -427,11 +445,51 @@
FontSize="18"
FontWeight="ExtraBold"
MouseLeftButtonUp="TextBlock_MouseLeftButtonUp"
Text="{x:Static lang:Resources.NA}" />
Text="{x:Static lang:Resources.NA}" />
</StackPanel>
</Grid>
</Border>

</WrapPanel>
<Popup
x:Name="OptionsPopup"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=OptionsBtn}"
PopupAnimation="Slide"
StaysOpen="False">
<Border
Margin="8"
Padding="10"
Background="{DynamicResource Background1}"
CornerRadius="5">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="{x:Static lang:Resources.Requests}" />
<TextBox
x:Name="RequestsNumberTxt"
Width="40"
Margin="5 0"
Padding="2"
VerticalAlignment="Center"
d:Text="4"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
PreviewTextInput="RequestsNumberTxt_PreviewTextInput"
Text="4"
TextChanged="RequestsNumberTxt_TextChanged" />
</StackPanel>

<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Opacity="0.4"
RenderingBias="Quality"
ShadowDepth="0"
Color="Black" />
</Border.Effect>
</Border>
</Popup>
</Grid>
</Page>
31 changes: 27 additions & 4 deletions InternetTest/InternetTest/Pages/PingPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;

Expand All @@ -43,10 +44,12 @@ public PingPage()
Loaded += (o, e) => SynethiaManager.InjectSynethiaCode(this, Global.SynethiaConfig.PagesInfo, 5, ref codeInjected);
}

int requestsToMake = 4;
private void InitUI()
{
TitleTxt.Text = $"{Properties.Resources.Commands} > {Properties.Resources.Ping}";
IpTxt.Text = Global.Settings.TestSite ?? "https://leocorporation.dev";
RequestsNumberTxt.Text = requestsToMake.ToString();
}

internal void PingBtn_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -76,15 +79,15 @@ private async void MakePing(string address)

int sent = 0, received = 0;

long[] times = new long[4]; // Create an array
for (int i = 0; i < 4; i++)
long[] times = new long[requestsToMake]; // Create an array
for (int i = 0; i < requestsToMake; i++)
{
var ping = await new Ping().SendPingAsync(address); // Send a ping
sent++;
times[i] = ping.RoundtripTime; // Get the time of the ping
IPAddressTxt.Text = ping.Address.ToString(); // Get the address of the ping

string nl = (i + 1 < 4) ? $"\n{i + 1}/4" : ""; // Add a new line if it's not the last ping
string nl = (i + 1 < requestsToMake) ? $"\n{i + 1}/{requestsToMake}" : ""; // Add a new line if it's not the last ping
if (ping.Status == IPStatus.Success)
{
received++;
Expand All @@ -101,7 +104,7 @@ private async void MakePing(string address)
}
}

AverageTimeTxt.Text = $"{times.Average()}ms"; // Get the average of the times
AverageTimeTxt.Text = $"{times.Average():0.00}ms"; // Get the average of the times
MinTimeTxt.Text = $"{times.Min()}ms"; // Get the minimum of the times
MaxTimeTxt.Text = $"{times.Max()}ms"; // Get the maximum of the times

Expand All @@ -123,4 +126,24 @@ private void TextBlock_MouseLeftButtonUp(object sender, System.Windows.Input.Mou
{
Clipboard.SetText(((TextBlock)sender).Text);
}

private void OptionsBtn_Click(object sender, RoutedEventArgs e)
{
OptionsPopup.IsOpen = true;
}

private void RequestsNumberTxt_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
requestsToMake = int.Parse(RequestsNumberTxt.Text);
}
catch { }
}

private void RequestsNumberTxt_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
Regex regex = new("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}
}
18 changes: 18 additions & 0 deletions InternetTest/InternetTest/Pages/TraceroutePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@
FontWeight="ExtraBold"
Foreground="{DynamicResource WindowButtonsHoverForeground1}"
Style="{DynamicResource PrimaryButton}" />
<Button
x:Name="HideTimedOutBtn"
Margin="5 0"
Padding="5 4"
VerticalAlignment="Center"
Background="{DynamicResource LightAccent}"
BorderThickness="0"
Click="HideTimedOutBtn_Click"
Content="&#xF3FC;"
Cursor="Hand"
FontFamily="../Fonts/#FluentSystemIcons-Regular"
FontWeight="ExtraBold"
Foreground="{DynamicResource Accent}"
Style="{DynamicResource PrimaryButton}">
<Button.ToolTip>
<ToolTip Content="{x:Static lang:Resources.ShowHideTimedOut}" />
</Button.ToolTip>
</Button>
</StackPanel>
<StackPanel
x:Name="StatusPanel"
Expand Down
Loading

0 comments on commit 8112f39

Please sign in to comment.