From 173494641a124451df30882d91aa5eb4daba8cb7 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Wed, 2 Aug 2023 10:37:27 +0100 Subject: [PATCH 1/3] Show all inner exceptions for connectivity dialog maybe using a viewmodel isnt a bad idea after all... --- .../Dialogs/ConnectivityDialog.xaml.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Bloxstrap/UI/Elements/Dialogs/ConnectivityDialog.xaml.cs b/Bloxstrap/UI/Elements/Dialogs/ConnectivityDialog.xaml.cs index b34a905..c16025a 100644 --- a/Bloxstrap/UI/Elements/Dialogs/ConnectivityDialog.xaml.cs +++ b/Bloxstrap/UI/Elements/Dialogs/ConnectivityDialog.xaml.cs @@ -16,17 +16,12 @@ namespace Bloxstrap.UI.Elements.Dialogs { public ConnectivityDialog(string targetName, string description, Exception exception) { - Exception? innerException = exception.InnerException; - InitializeComponent(); TitleTextBlock.Text = $"{App.ProjectName} is unable to connect to {targetName}"; DescriptionTextBlock.Text = description; - ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}"; - - if (innerException is not null) - ErrorRichTextBox.Selection.Text += $"\n\n===== Inner Exception =====\n{innerException.GetType()}: {innerException.Message}"; + AddException(exception); CloseButton.Click += delegate { @@ -41,5 +36,18 @@ namespace Bloxstrap.UI.Elements.Dialogs PInvoke.FlashWindow((HWND)hWnd, true); }; } + + private void AddException(Exception exception, bool inner = false) + { + if (!inner) + ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}"; + + if (exception.InnerException is null) + return; + + ErrorRichTextBox.Selection.Text += $"\n\n[Inner Exception]\n{exception.InnerException.GetType()}: {exception.InnerException.Message}"; + + AddException(exception.InnerException, true); + } } } From ba57d584f0fbfafc8c01bdf63f01663207bd4aa7 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Wed, 2 Aug 2023 14:59:29 +0100 Subject: [PATCH 2/3] Remove redundant connectivity check keep the single connectivity check for testing if the roblox website can be contacted --- Bloxstrap/App.xaml.cs | 27 ---------------------- Bloxstrap/Bootstrapper.cs | 48 +++++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index cfd4ed9..1651f21 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -148,33 +148,6 @@ namespace Bloxstrap IsUpgrade = true; } } - - if (!IsMenuLaunch) - { - Logger.WriteLine(LOG_IDENT, "Performing connectivity check..."); - - try - { - HttpClient.GetAsync("https://detectportal.firefox.com").Wait(); - Logger.WriteLine(LOG_IDENT, "Connectivity check finished"); - } - catch (Exception ex) - { - Logger.WriteLine(LOG_IDENT, "Connectivity check failed!"); - Logger.WriteException(LOG_IDENT, ex); - - if (ex.GetType() == typeof(AggregateException)) - ex = ex.InnerException!; - - Controls.ShowConnectivityDialog( - "the internet", - $"Something may be preventing {ProjectName} from connecting to the internet, or you are currently offline. Please check and try again.", - ex - ); - - Terminate(ErrorCode.ERROR_CANCELLED); - } - } using (var checker = new InstallChecker()) { diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 024fa9b..d119c0d 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -114,6 +114,33 @@ namespace Bloxstrap return; } + // connectivity check + + App.Logger.WriteLine(LOG_IDENT, "Performing connectivity check..."); + + try + { + await RobloxDeployment.GetInfo(RobloxDeployment.DefaultChannel); + App.Logger.WriteLine(LOG_IDENT, "Connectivity check finished"); + } + catch (Exception ex) + { + App.Logger.WriteLine(LOG_IDENT, "Connectivity check failed!"); + App.Logger.WriteException(LOG_IDENT, ex); + + string message = $"It's possible that something is preventing {App.ProjectName} from connecting to the internet. Please check and try again."; + + if (ex.GetType() == typeof(HttpResponseException)) + message = "Roblox may be down right now. See status.roblox.com for more information. Please try again later."; + + if (ex.GetType() == typeof(AggregateException)) + ex = ex.InnerException!; + + Controls.ShowConnectivityDialog("Roblox", message, ex); + + App.Terminate(ErrorCode.ERROR_CANCELLED); + } + #if !DEBUG if (!App.IsFirstRun && App.Settings.Prop.CheckForUpdates) await CheckForUpdates(); @@ -188,25 +215,8 @@ namespace Bloxstrap private async Task CheckLatestVersion() { SetStatus("Connecting to Roblox..."); - - ClientVersion clientVersion; - - try - { - clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); - } - catch (Exception ex) - { - string message = "It's possible that Roblox is being blocked by a firewall. Please check and try again."; - - if (ex.GetType() == typeof(HttpResponseException)) - message = "Roblox may be down right now. See status.roblox.com for more information. Please try again later."; - - Controls.ShowConnectivityDialog("Roblox", message, ex); - - App.Terminate(ErrorCode.ERROR_CANCELLED); - return; - } + + var clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); if (clientVersion.IsBehindDefaultChannel) { From dd06d9c3d1416c00df4611aa7e95f4a4ffdc7c47 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Wed, 2 Aug 2023 16:51:17 +0100 Subject: [PATCH 3/3] Bump to 2.5.1 --- Bloxstrap/Bloxstrap.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Bloxstrap.csproj b/Bloxstrap/Bloxstrap.csproj index 2257c75..48fc5dc 100644 --- a/Bloxstrap/Bloxstrap.csproj +++ b/Bloxstrap/Bloxstrap.csproj @@ -7,8 +7,8 @@ true True Bloxstrap.ico - 2.5.0 - 2.5.0.0 + 2.5.1 + 2.5.1.0 app.manifest