mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-05 21:17:14 -05:00
Merge pull request #693 from kwsch/f/open-file-remember-directory
Simplified OpenFileDialog logic
This commit is contained in:
commit
584a178b27
|
|
@ -280,27 +280,19 @@ private void mainMenuOpen(object sender, EventArgs e)
|
|||
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = $"Decrypted PKM File|{supported}" +
|
||||
Filter = $"Supported Files|main;*.sav;*.bin;*.{ekx};{supported}" +
|
||||
$"|3DS Main Files|main" +
|
||||
$"|Save Files|*.sav" +
|
||||
$"|Decrypted PKM File|{supported}" +
|
||||
$"|Encrypted PKM File|*.{ekx}" +
|
||||
"|Binary File|*.bin" +
|
||||
"|All Files|*.*",
|
||||
RestoreDirectory = true,
|
||||
FilterIndex = 4,
|
||||
FileName = "main",
|
||||
};
|
||||
|
||||
// Reset file dialog path if it no longer exists
|
||||
if (!Directory.Exists(ofd.InitialDirectory))
|
||||
ofd.InitialDirectory = WorkingDirectory;
|
||||
"|All Files|*.*"
|
||||
};
|
||||
|
||||
// Detect main
|
||||
string path = SaveUtil.detectSaveFile();
|
||||
if (path != null)
|
||||
{ ofd.InitialDirectory = Path.GetDirectoryName(path); }
|
||||
else if (File.Exists(Path.Combine(ofd.InitialDirectory, "main")))
|
||||
{ }
|
||||
else if (!Directory.Exists(ofd.InitialDirectory))
|
||||
{ ofd.RestoreDirectory = false; ofd.FilterIndex = 1; ofd.FileName = ""; }
|
||||
{ ofd.FileName = path; }
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
openQuick(ofd.FileName);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user