Skip to content

Commit

Permalink
Setting: change max recently loaded sav file count
Browse files Browse the repository at this point in the history
  • Loading branch information
kwsch committed Mar 17, 2024
1 parent c3c7fac commit 3dd6089
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 12 additions & 3 deletions PKHeX.WinForms/Properties/PKHeXSettings.cs
Expand Up @@ -141,7 +141,18 @@ public sealed class StartupSettings : IStartupSettings
public PluginLoadSetting PluginLoadMethod { get; set; } = PluginLoadSetting.LoadFrom;

[Browsable(false)]
public List<string> RecentlyLoaded { get; set; } = new(MaxRecentCount);
public List<string> RecentlyLoaded { get; set; } = new(DefaultMaxRecent);

private const int DefaultMaxRecent = 10;
private uint MaxRecentCount = DefaultMaxRecent;

[LocalizedDescription("Amount of recently loaded save files to remember.")]
public uint RecentlyLoadedMaxCount
{
get => MaxRecentCount;
// Sanity check to not let the user foot-gun themselves a slow recall time.
set => MaxRecentCount = Math.Clamp(value, 1, 1000);
}

// Don't let invalid values slip into the startup version.
private GameVersion _defaultSaveVersion = PKX.Version;
Expand Down Expand Up @@ -171,8 +182,6 @@ public GameVersion DefaultSaveVersion
}
}

private const int MaxRecentCount = 10;

public void LoadSaveFile(string path)
{
var recent = RecentlyLoaded;
Expand Down
4 changes: 0 additions & 4 deletions PKHeX.WinForms/Subforms/SAV_FolderList.cs
Expand Up @@ -130,8 +130,6 @@ private static IEnumerable<CustomFolderPath> GetConsolePaths(IEnumerable<string>
return [];

var root = Path.GetPathRoot(path3DS);
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// ReSharper disable once HeuristicUnreachableCode
if (root == null)
return [];

Expand All @@ -146,8 +144,6 @@ private static IEnumerable<CustomFolderPath> GetSwitchPaths(IEnumerable<string>
return [];

var root = Path.GetPathRoot(pathNX);
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// ReSharper disable once HeuristicUnreachableCode
if (root == null)
return [];

Expand Down

0 comments on commit 3dd6089

Please sign in to comment.