diff --git a/NHSE.WinForms/Main.cs b/NHSE.WinForms/Main.cs index 2d86ad9..d8d7a0f 100644 --- a/NHSE.WinForms/Main.cs +++ b/NHSE.WinForms/Main.cs @@ -1,6 +1,8 @@ using System; +using System.IO; using System.Windows.Forms; using NHSE.Core; +using NHSE.WinForms.Properties; namespace NHSE.WinForms { @@ -41,6 +43,19 @@ private void Main_DragDrop(object sender, DragEventArgs e) private void Menu_Open(object sender, EventArgs e) { + if ((ModifierKeys & Keys.Control) != 0) + { + // Detect save file from SD cards? + } + else if ((ModifierKeys & Keys.Shift) != 0) + { + var path = Settings.Default.LastFilePath; + if (Directory.Exists(path)) + { + Open(path); + return; + } + } using var fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) Open(fbd.SelectedPath); @@ -48,14 +63,14 @@ private void Menu_Open(object sender, EventArgs e) private static void Open(string path) { - if ((ModifierKeys & Keys.Control) != 0) - { - // Detect save file from SD cards? - } try { var file = new HorizonSave(path); Open(file); + + var settings = Settings.Default; + settings.LastFilePath = path; + settings.Save(); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) diff --git a/NHSE.WinForms/NHSE.WinForms.csproj b/NHSE.WinForms/NHSE.WinForms.csproj index 988f6ab..03eec18 100644 --- a/NHSE.WinForms/NHSE.WinForms.csproj +++ b/NHSE.WinForms/NHSE.WinForms.csproj @@ -34,6 +34,11 @@ True Resources.resx + + True + True + Settings.settings + @@ -47,4 +52,11 @@ + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + \ No newline at end of file diff --git a/NHSE.WinForms/Properties/Settings.Designer.cs b/NHSE.WinForms/Properties/Settings.Designer.cs new file mode 100644 index 0000000..7bbda3b --- /dev/null +++ b/NHSE.WinForms/Properties/Settings.Designer.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NHSE.WinForms.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string LastFilePath { + get { + return ((string)(this["LastFilePath"])); + } + set { + this["LastFilePath"] = value; + } + } + } +} diff --git a/NHSE.WinForms/Properties/Settings.settings b/NHSE.WinForms/Properties/Settings.settings new file mode 100644 index 0000000..1aaa44d --- /dev/null +++ b/NHSE.WinForms/Properties/Settings.settings @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file