Prompt user for clipboard directory use if present for box dump/save (#3566)

This commit is contained in:
berichan
2022-08-10 02:03:00 +01:00
committed by GitHub
parent 59fad0e8cf
commit ef0b3f9607
2 changed files with 13 additions and 1 deletions

View File

@@ -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";

View File

@@ -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;