Skip to content

Commit

Permalink
Merge pull request #629 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 8.7.0.2411
  • Loading branch information
lpeyr authored Nov 30, 2024
2 parents 6519e25 + 532a7f8 commit 3caff45
Show file tree
Hide file tree
Showing 23 changed files with 786 additions and 710 deletions.
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,9 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBox">
<Setter Property="CaretBrush" Value="{DynamicResource Foreground1}" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
2 changes: 1 addition & 1 deletion InternetTest/InternetTest/Classes/DnsCacheInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

using System.Text.Json.Serialization;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace InternetTest.Classes;

Expand Down
16 changes: 11 additions & 5 deletions InternetTest/InternetTest/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ public static class Global
#if NIGHTLY
private static DateTime Date => System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetEntryAssembly().Location);

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

#else
public static string Version => "8.6.1.2409";
public static string Version => "8.7.0.2411";
#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";

#if PORTABLE
public static string DefaultStoragePath => $@"{FileSys.CurrentDirectory}\InternetTest Pro\";
#else
public static string DefaultStoragePath => $@"{FileSys.AppDataPath}\Léo Corporation\InternetTest Pro\";
#endif
public static string SynethiaPath => $@"{DefaultStoragePath}\NewSynethiaConfig.json";
public static bool IsConfidentialModeEnabled { get; set; } = false;
public static Settings Settings { get; set; } = SettingsManager.Load();
public static SynethiaConfig SynethiaConfig { get; set; } = LoadConfig();
Expand Down Expand Up @@ -286,7 +292,7 @@ public static bool IsUrlValid(string url)
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
}

public async static Task<IPInfo?> GetIPInfoAsync(string ip)
public static async Task<IPInfo?> GetIPInfoAsync(string ip)
{
try
{
Expand Down Expand Up @@ -649,7 +655,7 @@ public static async Task<DnsCacheInfo[]> GetDnsCache()
public static async Task<string> RunPowerShellCommandAsync(string psCommand)
{
// Create a new process to run PowerShell
ProcessStartInfo processInfo = new ProcessStartInfo
ProcessStartInfo processInfo = new()
{
FileName = "powershell.exe",
Arguments = $"-Command \"{psCommand}\"",
Expand Down
21 changes: 13 additions & 8 deletions InternetTest/InternetTest/Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using InternetTest.Enums;
using PeyrSharp.Env;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -54,6 +53,10 @@ public Settings()
TraceRouteMaxTimeOut = 5000;
MainWindowSize = (950, 600);
LaunchIpLocationOnStart = true;
DownDetectorWebsites = [];
DefaultTimeInterval = 10;
HideDisabledAdapters = false;
MapZoomLevel = 12;
}

public Themes Theme { get; set; }
Expand All @@ -78,25 +81,25 @@ public Settings()
public List<string>? DownDetectorWebsites { get; set; }
public int? DefaultTimeInterval { get; set; }
public bool? HideDisabledAdapters { get; set; }
public int? MapZoomLevel { get; set; }
}

public static class SettingsManager
{
private static string SettingsPath => $@"{FileSys.AppDataPath}\Léo Corporation\InternetTest Pro\Settings.xml";
public static Settings Load()
{
if (!Directory.Exists($@"{FileSys.AppDataPath}\Léo Corporation\InternetTest Pro\"))
if (!Directory.Exists(Global.DefaultStoragePath))
{
Directory.CreateDirectory($@"{FileSys.AppDataPath}\Léo Corporation\InternetTest Pro\");
Directory.CreateDirectory(Global.DefaultStoragePath);
}

if (!File.Exists(SettingsPath))
if (!File.Exists($@"{Global.DefaultStoragePath}\Settings.xml"))
{
Global.Settings = new();

// Serialize to XML
XmlSerializer xmlSerializer = new(typeof(Settings));
StreamWriter streamWriter = new(SettingsPath);
StreamWriter streamWriter = new($@"{Global.DefaultStoragePath}\Settings.xml");
xmlSerializer.Serialize(streamWriter, Global.Settings);
streamWriter.Dispose();
return new();
Expand All @@ -106,7 +109,7 @@ public static Settings Load()
// Deserialize from xml
XmlSerializer xmlDeserializer = new(typeof(Settings));

StreamReader streamReader = new(SettingsPath);
StreamReader streamReader = new($@"{Global.DefaultStoragePath}\Settings.xml");
var settings = (Settings?)xmlDeserializer.Deserialize(streamReader) ?? new();

// Upgrade the settings file if it comes from an older version
Expand All @@ -122,6 +125,7 @@ public static Settings Load()
settings.DownDetectorWebsites ??= [];
settings.DefaultTimeInterval ??= 10;
settings.HideDisabledAdapters ??= false;
settings.MapZoomLevel ??= 12;

return settings;
}
Expand All @@ -130,7 +134,7 @@ public static void Save()
{
// Serialize to XML
XmlSerializer xmlSerializer = new(typeof(Settings));
StreamWriter streamWriter = new(SettingsPath);
StreamWriter streamWriter = new($@"{Global.DefaultStoragePath}\Settings.xml");
xmlSerializer.Serialize(streamWriter, Global.Settings);
streamWriter.Dispose();
}
Expand Down Expand Up @@ -186,6 +190,7 @@ public static void Import(string path)
settings.DownDetectorWebsites ??= [];
settings.DefaultTimeInterval ??= 10;
settings.HideDisabledAdapters ??= false;
settings.MapZoomLevel ??= 12;

Global.Settings = settings;

Expand Down
4 changes: 2 additions & 2 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.6.1.2409</Version>
<Version>8.7.0.2411</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 @@ -41,7 +41,7 @@
<PackageReference Include="PeyrSharp.Core" Version="2.1.0.2312" />
<PackageReference Include="PeyrSharp.Env" Version="2.1.0.2312" />
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="RestSharp" Version="112.0.0" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="Synethia" Version="1.1.1.2302" />
<PackageReference Include="Whois" Version="3.0.1" />
</ItemGroup>
Expand Down
210 changes: 197 additions & 13 deletions InternetTest/InternetTest/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,20 +257,204 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Grid.ColumnSpan="3">
<TextBlock
Grid.Column="1"
Margin="0 10 0 0"
FontSize="36"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.InternetTest}" />
<TextBlock
x:Name="HelloTxt"
<Grid Grid.Column="1" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock
Grid.Column="1"
Margin="0 10 0 0"
FontSize="36"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.InternetTest}" />
<TextBlock
x:Name="HelloTxt"
Grid.Column="1"
FontSize="16"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.InternetTest}" />
</StackPanel>
<StackPanel
Grid.Column="1"
FontSize="16"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.InternetTest}" />
</StackPanel>
VerticalAlignment="Center"
Orientation="Horizontal" Margin="0,0,10,0">
<Border
x:Name="StatusBorder"
Margin="0"
Padding="5 2"
CornerRadius="5"
MouseEnter="StatusBorder_MouseEnter"
MouseLeave="StatusBorder_MouseLeave">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="StatusIconTxt"
VerticalAlignment="Center"
FontFamily="/Fonts/#FluentSystemIcons-Filled"
FontSize="32"
Foreground="{DynamicResource Accent}"
Text="&#xF648;" />
<StackPanel
Grid.Column="1"
Margin="5 0 0 0"
VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="14"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.Status}" />
<TextBlock
x:Name="StatusTxt"
FontSize="10"
FontWeight="SemiBold"
Text="{x:Static lang:Resources.Unknown}" />
</StackPanel>
<Button
x:Name="RefreshStatusBtn"
Grid.Column="2"
Margin="2 0"
Background="Transparent"
Click="RefreshStatusBtn_Click"
Content="&#xF191;"
FontFamily="/Fonts/#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource ToolButton}"
Visibility="Hidden" />
</Grid>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource CardBackground}" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<Border
x:Name="NetworkBorder"
Margin="0"
Padding="5 2"
CornerRadius="5"
MouseEnter="NetworkBorder_MouseEnter"
MouseLeave="NetworkBorder_MouseLeave">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="NetworkIconTxt"
VerticalAlignment="Center"
FontFamily="/Fonts/#FluentSystemIcons-Filled"
FontSize="32"
Foreground="{DynamicResource Accent}"
Text="&#xF8C5;" />
<StackPanel
Grid.Column="1"
Margin="5 0 0 0"
VerticalAlignment="Center">
<TextBlock
x:Name="NetworkTitleTxt"
VerticalAlignment="Center"
FontSize="14"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.Network}" />
<TextBlock
x:Name="NetworkTxt"
FontSize="10"
FontWeight="SemiBold"
Text="{x:Static lang:Resources.ConnectedS}" />
</StackPanel>
<Button
x:Name="RefreshNetworkBtn"
Grid.Column="2"
Margin="2 0"
Background="Transparent"
Click="RefreshNetworkBtn_Click"
Content="&#xF191;"
FontFamily="/Fonts/#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource ToolButton}"
Visibility="Hidden" />
</Grid>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource CardBackground}" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<Border
x:Name="MyIpBorder"
MinWidth="180"
Margin="0"
Padding="5 2"
CornerRadius="5"
MouseEnter="MyIpBorder_MouseEnter"
MouseLeave="MyIpBorder_MouseLeave">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="MyIpIconTxt"
VerticalAlignment="Center"
FontFamily="/Fonts/#FluentSystemIcons-Filled"
FontSize="32"
Foreground="{DynamicResource Accent}"
Text="&#xF3DA;" />
<StackPanel
Grid.Column="1"
Margin="5 0 0 0"
VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="14"
FontWeight="ExtraBold"
Text="{x:Static lang:Resources.MyIP}" />
<TextBlock
x:Name="MyIpTxt"
FontSize="10"
FontWeight="SemiBold"
Text="{x:Static lang:Resources.HoverToReveal}" />
</StackPanel>
<Button
x:Name="RefreshMyIpBtn"
Grid.Column="2"
Margin="2 0"
Background="Transparent"
Click="RefreshMyIpBtn_Click"
Content="&#xF191;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource ToolButton}"
Visibility="Hidden" />
</Grid>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource CardBackground}" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
</StackPanel>
</Grid>
<StackPanel
x:Name="SideBar"
Grid.Row="1"
Expand Down
Loading

0 comments on commit 3caff45

Please sign in to comment.