diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index d8d9154..2d09823 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -87,6 +87,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Failed to copy to the clipboard: {0}. + /// + public static string Bootstrapper_ClipboardCopyFailed { + get { + return ResourceManager.GetString("Bootstrapper.ClipboardCopyFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 1e06c17..6b62ab8 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -126,6 +126,9 @@ Bloxstrap was unable to auto-update to {0}. Please update it manually by downloading and running the latest release from the GitHub page. + + Failed to copy to the clipboard: {0} + Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching? diff --git a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs index 3d8c372..f1450d8 100644 --- a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs +++ b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs @@ -1,4 +1,5 @@ using System.Media; +using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; using System.Windows.Interop; @@ -30,9 +31,20 @@ namespace Bloxstrap.UI.Elements.Dialogs LocateLogFileButton.Click += delegate { if (App.Logger.Initialized) + { Process.Start("explorer.exe", $"/select,\"{App.Logger.FileLocation}\""); + } else - Clipboard.SetDataObject(String.Join("\r\n", App.Logger.Backlog)); + { + try + { + Clipboard.SetText(String.Join("\r\n", App.Logger.Backlog)); + } + catch (COMException ex) + { + Frontend.ShowMessageBox(string.Format(Bloxstrap.Resources.Strings.Bootstrapper_ClipboardCopyFailed, ex.Message), MessageBoxImage.Error); + } + } }; ReportOptions.DropDownClosed += (sender, e) => diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs index 751a79e..4d7a6a2 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs @@ -6,6 +6,7 @@ using System.Collections.ObjectModel; using Wpf.Ui.Mvvm.Contracts; using Bloxstrap.UI.Elements.Dialogs; +using System.Runtime.InteropServices; namespace Bloxstrap.UI.Elements.Menu.Pages { @@ -341,8 +342,22 @@ namespace Bloxstrap.UI.Elements.Menu.Pages private void ExportJSONButton_Click(object sender, RoutedEventArgs e) { + const string LOG_IDENT = "FastFlagEditorPage::ExportJSONButton_Click"; + string json = JsonSerializer.Serialize(App.FastFlags.Prop, new JsonSerializerOptions { WriteIndented = true }); - Clipboard.SetText(json); + + try + { + Clipboard.SetText(json); + } + catch (COMException ex) + { + App.Logger.WriteLine(LOG_IDENT, "Failed to copy to the clipboard"); + App.Logger.WriteException(LOG_IDENT, ex); + Frontend.ShowMessageBox(string.Format(Bloxstrap.Resources.Strings.Bootstrapper_ClipboardCopyFailed, ex.Message), MessageBoxImage.Error); + return; + } + Frontend.ShowMessageBox(Bloxstrap.Resources.Strings.Menu_FastFlagEditor_JsonCopiedToClipboard, MessageBoxImage.Information); }