diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 62116b9..8cd32f4 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -753,8 +753,7 @@ namespace Bloxstrap List modFolderFiles = new(); - if (!Directory.Exists(Paths.Modifications)) - Directory.CreateDirectory(Paths.Modifications); + Directory.CreateDirectory(Paths.Modifications); // check custom font mod // instead of replacing the fonts themselves, we'll just alter the font family manifests diff --git a/Bloxstrap/Integrations/ActivityWatcher.cs b/Bloxstrap/Integrations/ActivityWatcher.cs index 673e195..b1d13d4 100644 --- a/Bloxstrap/Integrations/ActivityWatcher.cs +++ b/Bloxstrap/Integrations/ActivityWatcher.cs @@ -36,7 +36,6 @@ public event EventHandler? OnAppClose; public event EventHandler? OnRPCMessage; - private readonly Dictionary GeolocationCache = new(); private DateTime LastRPCRequest; public string LogLocation = null!; diff --git a/Bloxstrap/JsonManager.cs b/Bloxstrap/JsonManager.cs index 8e786be..58a1e25 100644 --- a/Bloxstrap/JsonManager.cs +++ b/Bloxstrap/JsonManager.cs @@ -60,7 +60,21 @@ namespace Bloxstrap App.Logger.WriteLine(LOG_IDENT, $"Saving to {FileLocation}..."); Directory.CreateDirectory(Path.GetDirectoryName(FileLocation)!); - File.WriteAllText(FileLocation, JsonSerializer.Serialize(Prop, new JsonSerializerOptions { WriteIndented = true })); + + try + { + File.WriteAllText(FileLocation, JsonSerializer.Serialize(Prop, new JsonSerializerOptions { WriteIndented = true })); + } + catch (IOException ex) + { + App.Logger.WriteLine(LOG_IDENT, "Failed to save"); + App.Logger.WriteException(LOG_IDENT, ex); + + string errorMessage = string.Format(Resources.Strings.Bootstrapper_JsonManagerSaveFailed, ClassName, ex.Message); + Frontend.ShowMessageBox(errorMessage, System.Windows.MessageBoxImage.Warning); + + return; + } App.Logger.WriteLine(LOG_IDENT, "Save complete!"); } diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index e8df8ff..40c1f30 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -170,6 +170,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Failed to save {0}: {1}. + /// + public static string Bootstrapper_JsonManagerSaveFailed { + get { + return ResourceManager.GetString("Bootstrapper.JsonManagerSaveFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Bloxstrap does not have enough disk space to download and install Roblox. Please free up some disk space and try again.. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index f0f1a4f..5116519 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1195,4 +1195,7 @@ Please manually delete Bloxstrap.exe from the install location or try restarting Are you sure you want to cancel the installation? + + Failed to save {0}: {1} + \ No newline at end of file diff --git a/Bloxstrap/UI/Elements/Settings/Pages/IntegrationsPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/IntegrationsPage.xaml index 8bafca9..9f409a9 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/IntegrationsPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/IntegrationsPage.xaml @@ -89,7 +89,7 @@ - + diff --git a/Bloxstrap/UI/Frontend.cs b/Bloxstrap/UI/Frontend.cs index f1dfab2..21cca14 100644 --- a/Bloxstrap/UI/Frontend.cs +++ b/Bloxstrap/UI/Frontend.cs @@ -17,20 +17,7 @@ namespace Bloxstrap.UI if (App.LaunchSettings.QuietFlag.Active) return defaultResult; - if (App.LaunchSettings.RobloxLaunchMode != LaunchMode.None) - return ShowFluentMessageBox(message, icon, buttons); - - switch (App.Settings.Prop.BootstrapperStyle) - { - case BootstrapperStyle.FluentDialog: - case BootstrapperStyle.ClassicFluentDialog: - case BootstrapperStyle.FluentAeroDialog: - case BootstrapperStyle.ByfronDialog: - return ShowFluentMessageBox(message, icon, buttons); - - default: - return MessageBox.Show(message, App.ProjectName, buttons, icon); - } + return ShowFluentMessageBox(message, icon, buttons); } public static void ShowPlayerErrorDialog(bool crash = false) diff --git a/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs index aed332e..042b138 100644 --- a/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs @@ -57,6 +57,7 @@ namespace Bloxstrap.UI.ViewModels.Settings if (dialog.ShowDialog() != true) return; + SelectedCustomIntegration.Name = dialog.SafeFileName; SelectedCustomIntegration.Location = dialog.FileName; OnPropertyChanged(nameof(SelectedCustomIntegration)); } diff --git a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs index f235af0..fa2b984 100644 --- a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs @@ -108,7 +108,7 @@ namespace Bloxstrap.UI.ViewModels.Settings string path = new RobloxPlayerData().ExecutablePath; if (File.Exists(path)) - PInvoke.SHObjectProperties(HWND.Null, SHOP_TYPE.SHOP_FILEPATH, path, "Compatibility"); + PInvoke.SHObjectProperties(HWND.Null, SHOP_TYPE.SHOP_FILEPATH, path, "Compatibility"); else Frontend.ShowMessageBox(Strings.Common_RobloxNotInstalled, MessageBoxImage.Error); diff --git a/Bloxstrap/Utilities.cs b/Bloxstrap/Utilities.cs index 327f734..6d16a27 100644 --- a/Bloxstrap/Utilities.cs +++ b/Bloxstrap/Utilities.cs @@ -50,7 +50,6 @@ namespace Bloxstrap public static string GetRobloxVersion(bool studio) { - string versionGuid = studio ? App.State.Prop.Studio.VersionGuid : App.State.Prop.Player.VersionGuid; string fileName = studio ? "Studio/RobloxStudioBeta.exe" : "Player/RobloxPlayerBeta.exe"; string playerLocation = Path.Combine(Paths.Roblox, fileName);