Misc user protections

trycatch SD card readonly check
Remove All medals now clears gen7 flags (for improper transfers)
This commit is contained in:
Kurt 2017-01-28 10:50:36 -08:00
parent ab5a0a7a3a
commit 5ae027c934
2 changed files with 12 additions and 6 deletions

View file

@ -1206,7 +1206,11 @@ namespace PKHeX.WinForms
if (!string.IsNullOrWhiteSpace(path)) // Actual Save if (!string.IsNullOrWhiteSpace(path)) // Actual Save
{ {
// Check location write protection // 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, 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."); "If the path is a removable disk (SD card), please ensure the write protection switch is not set.");
} }

View file

@ -121,6 +121,11 @@ namespace PKHeX.WinForms
pk6.TrainingBag = CB_Bag.SelectedIndex; pk6.TrainingBag = CB_Bag.SelectedIndex;
pk6.TrainingBagHits = (int)NUD_BagHits.Value; 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; Main.pkm = pkm;
} }
@ -151,12 +156,9 @@ namespace PKHeX.WinForms
c.Checked = true; c.Checked = true;
} }
private void B_None_Click(object sender, EventArgs e) private void B_None_Click(object sender, EventArgs e)
{
if (pkm is PK6)
{ {
CHK_SecretUnlocked.Checked = false; CHK_SecretUnlocked.Checked = false;
CHK_SecretComplete.Checked = false; CHK_SecretComplete.Checked = false;
}
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>()) foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>())
c.Checked = false; c.Checked = false;
foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>()) foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>())