diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 62116b9c..8cd32f49 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -753,8 +753,7 @@ private async Task ApplyModifications() 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 673e1959..b1d13d4f 100644 --- a/Bloxstrap/Integrations/ActivityWatcher.cs +++ b/Bloxstrap/Integrations/ActivityWatcher.cs @@ -36,7 +36,6 @@ public class ActivityWatcher : IDisposable 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 8e786bee..58a1e257 100644 --- a/Bloxstrap/JsonManager.cs +++ b/Bloxstrap/JsonManager.cs @@ -60,7 +60,21 @@ public virtual void Save() 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 7911c5ba..40c1f30f 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -170,6 +170,15 @@ public static string Bootstrapper_HyperionUpdateInfo { } } + /// + /// 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.. /// @@ -1520,6 +1529,15 @@ public static string Installer_Install_Title { } } + /// + /// Looks up a localized string similar to Are you sure you want to cancel the installation?. + /// + public static string Installer_ShouldCancel { + get { + return ResourceManager.GetString("Installer.ShouldCancel", resourceCulture); + } + } + /// /// Looks up a localized string similar to Bloxstrap Installer. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 0a04ef21..51165198 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1192,4 +1192,10 @@ Please manually delete Bloxstrap.exe from the install location or try restarting Roblox has not yet been installed. Please launch Roblox using Bloxstrap at least once before trying to use this option. + + 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/Installer/MainWindow.xaml.cs b/Bloxstrap/UI/Elements/Installer/MainWindow.xaml.cs index 90108bea..49e262c9 100644 --- a/Bloxstrap/UI/Elements/Installer/MainWindow.xaml.cs +++ b/Bloxstrap/UI/Elements/Installer/MainWindow.xaml.cs @@ -9,6 +9,7 @@ using Bloxstrap.UI.Elements.Base; using System.Windows.Media.Animation; using System.Reflection.Metadata.Ecma335; +using Bloxstrap.Resources; namespace Bloxstrap.UI.Elements.Installer { @@ -102,7 +103,7 @@ void MainWindow_Closing(object? sender, CancelEventArgs e) if (Finished) return; - var result = Frontend.ShowMessageBox("Are you sure you want to cancel the installation?", MessageBoxImage.Warning, MessageBoxButton.YesNo); + var result = Frontend.ShowMessageBox(Strings.Installer_ShouldCancel, MessageBoxImage.Warning, MessageBoxButton.YesNo); if (result != MessageBoxResult.Yes) e.Cancel = true; diff --git a/Bloxstrap/UI/Elements/Settings/Pages/IntegrationsPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/IntegrationsPage.xaml index 8bafca94..9f409a9d 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 f1dfab20..21cca14f 100644 --- a/Bloxstrap/UI/Frontend.cs +++ b/Bloxstrap/UI/Frontend.cs @@ -17,20 +17,7 @@ public static MessageBoxResult ShowMessageBox(string message, MessageBoxImage ic 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 aed332ed..042b1382 100644 --- a/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/IntegrationsViewModel.cs @@ -57,6 +57,7 @@ private void BrowseIntegrationLocation() 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 f235af0b..fa2b9841 100644 --- a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs @@ -108,7 +108,7 @@ private void OpenCompatSettings() 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 327f7340..6d16a276 100644 --- a/Bloxstrap/Utilities.cs +++ b/Bloxstrap/Utilities.cs @@ -50,7 +50,6 @@ public static VersionComparison CompareVersions(string versionStr1, string versi 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);