From ef0b3f9607f57dc3085d97d4b4798ebb9ecbf6b9 Mon Sep 17 00:00:00 2001 From: berichan <66521620+berichan@users.noreply.github.com> Date: Wed, 10 Aug 2022 02:03:00 +0100 Subject: [PATCH] Prompt user for clipboard directory use if present for box dump/save (#3566) --- PKHeX.Core/Util/MessageStrings.cs | 3 ++- PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/Util/MessageStrings.cs b/PKHeX.Core/Util/MessageStrings.cs index 8c5911372..b048bfb0d 100644 --- a/PKHeX.Core/Util/MessageStrings.cs +++ b/PKHeX.Core/Util/MessageStrings.cs @@ -1,4 +1,4 @@ -// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global +// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global namespace PKHeX.Core; @@ -152,6 +152,7 @@ public static class MessageStrings public static string MsgSaveBoxClearAll { get; set; } = "Clear ALL Boxes?!"; public static string MsgSaveBoxClearAllFailBattle { get; set; } = "Battle Box slots prevent the clearing of all boxes."; public static string MsgSaveBoxClearAllSuccess { get; set; } = "Boxes cleared!"; + public static string MsgSaveBoxUseClipboard { get; set; } = "Use this folder found in your clipboard? {0}"; public static string MsgSaveBoxFailNone { get; set; } = "The currently loaded save file does not have boxes!"; public static string MsgSaveBoxExportYes { get; set; } = "Yes: Export All Boxes"; diff --git a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs index f80e3764c..f9f502f36 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs @@ -766,6 +766,17 @@ public bool GetBulkImportSettings(out bool clearAll, out bool overwrite, out PKM private static bool IsFolderPath(out string path) { + if (Clipboard.ContainsText()) + { + var directory = Clipboard.GetText(); + // Ask user if they want to use clipboard directory before showing folder browser + if (Directory.Exists(directory) && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, string.Format(MsgSaveBoxUseClipboard, directory)) == DialogResult.Yes) + { + path = directory; + return true; + } + } + using var fbd = new FolderBrowserDialog(); var result = fbd.ShowDialog() == DialogResult.OK; path = fbd.SelectedPath;