Skip to content

Commit

Permalink
Merge pull request #607 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 8.5.2.2408
  • Loading branch information
lpeyr authored Aug 23, 2024
2 parents 28d0990 + 6378bdc commit e272734
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 24 deletions.
18 changes: 12 additions & 6 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.5.1.2408-nightly{Date:yyMM.dd@HHmm}";
public static string Version => $"8.5.2.2408-nightly{Date:yyMM.dd@HHmm}";

#else
public static string Version => "8.5.1.2408";
public static string Version => "8.5.2.2408";
#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 Expand Up @@ -287,10 +287,16 @@ public static bool IsUrlValid(string url)

public async static Task<IPInfo?> GetIPInfoAsync(string ip)
{
HttpClient httpClient = new();
string result = await httpClient.GetStringAsync($"http://ip-api.com/json/{ip}");

return JsonSerializer.Deserialize<IPInfo>(result);
try
{
HttpClient httpClient = new();
string result = await httpClient.GetStringAsync($"http://ip-api.com/json/{ip}");
return JsonSerializer.Deserialize<IPInfo>(result);
}
catch
{
return null;
}
}

public static bool IsIpValid(string ip)
Expand Down
2 changes: 1 addition & 1 deletion 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.5.1.2408</Version>
<Version>8.5.2.2408</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
4 changes: 2 additions & 2 deletions InternetTest/InternetTest/Pages/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ internal async void InitUI()
LoadNetworkCard();

// Load "My IP" section
ip = (await Global.GetIPInfoAsync("")).Query ?? "";
ip = (await Global.GetIPInfoAsync(""))?.Query ?? "";
}

private async void RefreshStatusBtn_Click(object sender, System.Windows.RoutedEventArgs e)
Expand Down Expand Up @@ -127,7 +127,7 @@ private void RefreshNetworkBtn_Click(object sender, System.Windows.RoutedEventAr
string ip = "";
private async void RefreshMyIpBtn_Click(object sender, System.Windows.RoutedEventArgs e)
{
ip = (await Global.GetIPInfoAsync("")).Query ?? "";
ip = (await Global.GetIPInfoAsync(""))?.Query ?? "";
}

private void MyIpBorder_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
Expand Down
37 changes: 22 additions & 15 deletions InternetTest/InternetTest/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,30 +148,37 @@ private async void InitUI()

private async void CheckUpdateBtn_Click(object sender, RoutedEventArgs e)
{
string lastVersion = await Update.GetLastVersionAsync(Global.LastVersionLink);
if (Update.IsAvailable(Global.Version, lastVersion))
try
{
UpdateTxt.Text = Properties.Resources.AvailableUpdates;
string lastVersion = await Update.GetLastVersionAsync(Global.LastVersionLink);
if (Update.IsAvailable(Global.Version, lastVersion))
{
UpdateTxt.Text = Properties.Resources.AvailableUpdates;
#if PORTABLE
MessageBox.Show(Properties.Resources.PortableNoAutoUpdates, $"{Properties.Resources.InstallVersion} {lastVersion}", MessageBoxButton.OK, MessageBoxImage.Information);
return;
#else
if (MessageBox.Show(Properties.Resources.InstallConfirmMsg, $"{Properties.Resources.InstallVersion} {lastVersion}", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No)
{
return;
}
if (MessageBox.Show(Properties.Resources.InstallConfirmMsg, $"{Properties.Resources.InstallVersion} {lastVersion}", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No)
{
return;
}
#endif
// If the user wants to proceed.
SynethiaManager.Save(Global.SynethiaConfig, Global.SynethiaPath);
HistoryManager.Save(Global.History);
SettingsManager.Save();
// If the user wants to proceed.
SynethiaManager.Save(Global.SynethiaConfig, Global.SynethiaPath);
HistoryManager.Save(Global.History);
SettingsManager.Save();

Sys.ExecuteAsAdmin(Directory.GetCurrentDirectory() + @"\Xalyus Updater.exe"); // Start the updater
Application.Current.Shutdown(); // Close
Sys.ExecuteAsAdmin(Directory.GetCurrentDirectory() + @"\Xalyus Updater.exe"); // Start the updater
Application.Current.Shutdown(); // Close
}
else
{
UpdateTxt.Text = Properties.Resources.UpToDate;
}
}
else
catch
{
UpdateTxt.Text = Properties.Resources.UpToDate;
UpdateTxt.Text = Properties.Resources.UnableToCheckUpdates;
}
}

Expand Down
9 changes: 9 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,4 +1059,7 @@ Absolutely NO data is sent to Léo Corporation.</value>
<data name="Reset" xml:space="preserve">
<value>Reset</value>
</data>
<data name="UnableToCheckUpdates" xml:space="preserve">
<value>Unable to check for updates</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,4 +1059,7 @@ Absolument AUCUNE donnée n'est envoyée à Léo Corporation.</value>
<data name="Reset" xml:space="preserve">
<value>Réinitialiser</value>
</data>
<data name="UnableToCheckUpdates" xml:space="preserve">
<value>Impossible de vérifier les mises à jour</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.it-IT.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,4 +1059,7 @@ Assolutamente NESSUN dato verrà inviato a Léo Corporation.</value>
<data name="Reset" xml:space="preserve">
<value>Ripristina</value>
</data>
<data name="UnableToCheckUpdates" xml:space="preserve">
<value>Impossibile controllare gli aggiornamenti</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,4 +1059,7 @@ Absolutely NO data is sent to Léo Corporation.</value>
<data name="Reset" xml:space="preserve">
<value>Reset</value>
</data>
<data name="UnableToCheckUpdates" xml:space="preserve">
<value>Unable to check for updates</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1050,4 +1050,7 @@
<data name="Reset" xml:space="preserve">
<value>重置</value>
</data>
<data name="UnableToCheckUpdates" xml:space="preserve">
<value>无法检查更新</value>
</data>
</root>

0 comments on commit e272734

Please sign in to comment.