mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
Misc user protections
trycatch SD card readonly check Remove All medals now clears gen7 flags (for improper transfers)
This commit is contained in:
parent
ab5a0a7a3a
commit
5ae027c934
2 changed files with 12 additions and 6 deletions
|
@ -1206,7 +1206,11 @@ namespace PKHeX.WinForms
|
|||
if (!string.IsNullOrWhiteSpace(path)) // Actual Save
|
||||
{
|
||||
// Check location write protection
|
||||
if ((new DirectoryInfo(path).Attributes & FileAttributes.ReadOnly) != 0)
|
||||
bool locked = true;
|
||||
try { locked = (new DirectoryInfo(path).Attributes & FileAttributes.ReadOnly) != 0; }
|
||||
catch { }
|
||||
|
||||
if (locked)
|
||||
WinFormsUtil.Alert("Save file's location is write protected:\n" + path,
|
||||
"If the path is a removable disk (SD card), please ensure the write protection switch is not set.");
|
||||
}
|
||||
|
|
|
@ -121,6 +121,11 @@ namespace PKHeX.WinForms
|
|||
pk6.TrainingBag = CB_Bag.SelectedIndex;
|
||||
pk6.TrainingBagHits = (int)NUD_BagHits.Value;
|
||||
}
|
||||
else // clear flags if manually cleared
|
||||
{
|
||||
pkm.SecretSuperTrainingUnlocked &= CHK_SecretUnlocked.Checked;
|
||||
pkm.SecretSuperTrainingComplete &= CHK_SecretComplete.Checked;
|
||||
}
|
||||
|
||||
Main.pkm = pkm;
|
||||
}
|
||||
|
@ -152,11 +157,8 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
private void B_None_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (pkm is PK6)
|
||||
{
|
||||
CHK_SecretUnlocked.Checked = false;
|
||||
CHK_SecretComplete.Checked = false;
|
||||
}
|
||||
CHK_SecretUnlocked.Checked = false;
|
||||
CHK_SecretComplete.Checked = false;
|
||||
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>())
|
||||
c.Checked = false;
|
||||
foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>())
|
||||
|
|
Loading…
Reference in a new issue