mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-23 03:54:31 -05:00
Add error message if user moves file for backup
This commit is contained in:
@@ -136,6 +136,7 @@ public static class MessageStrings
|
||||
public static string MsgSaveSlotBadData { get; set; } = "Unable to set to this slot.";
|
||||
|
||||
public static string MsgSaveBackup { get; set; } = "Saved Backup of current SAV to:";
|
||||
public static string MsgSaveBackupNotFound { get; set; } = "Original file has been moved; unable to copy a backup.";
|
||||
public static string MsgSaveCurrentGeneration { get; set; } = "Current SAV Generation: {0}";
|
||||
|
||||
public static string MsgSaveBoxCloneFromTabs { get; set; } = "Clone Pokemon from Editing Tabs to all slots in {0}?";
|
||||
|
||||
@@ -783,11 +783,24 @@ public bool ExportBackup()
|
||||
{
|
||||
if (!SAV.State.Exportable || SAV.Metadata.FilePath is not { } file)
|
||||
return false;
|
||||
using var sfd = new SaveFileDialog {FileName = Util.CleanFileName(SAV.Metadata.BAKName)};
|
||||
|
||||
if (!File.Exists(file))
|
||||
{
|
||||
WinFormsUtil.Error(MsgSaveBackupNotFound, file);
|
||||
return false;
|
||||
}
|
||||
|
||||
var suggestion = Util.CleanFileName(SAV.Metadata.BAKName);
|
||||
using var sfd = new SaveFileDialog {FileName = suggestion};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return false;
|
||||
|
||||
string path = sfd.FileName;
|
||||
if (!File.Exists(file)) // did they move it again?
|
||||
{
|
||||
WinFormsUtil.Error(MsgSaveBackupNotFound, file);
|
||||
return false;
|
||||
}
|
||||
File.Copy(file, path);
|
||||
WinFormsUtil.Alert(MsgSaveBackup, path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user