Ignore detected saves when displaying backups

This commit is contained in:
Kurt 2018-07-18 21:26:18 -07:00
parent e5d95bf178
commit 33637836f2
2 changed files with 8 additions and 6 deletions

View file

@ -27,9 +27,9 @@ namespace PKHeX.WinForms
dgDataRecent.ContextMenuStrip = GetContextMenu(dgDataRecent); dgDataRecent.ContextMenuStrip = GetContextMenu(dgDataRecent);
dgDataBackup.ContextMenuStrip = GetContextMenu(dgDataBackup); dgDataBackup.ContextMenuStrip = GetContextMenu(dgDataBackup);
var recent = PathUtilWindows.GetSaveFiles(Paths.Select(z => z.Path).Where(z => z != Main.BackupPath)); var recent = PathUtilWindows.GetSaveFiles(true, Paths.Select(z => z.Path).Where(z => z != Main.BackupPath));
Recent = PopulateData(dgDataRecent, recent); Recent = PopulateData(dgDataRecent, recent);
var backup = PathUtilWindows.GetSaveFiles(Main.BackupPath); var backup = PathUtilWindows.GetSaveFiles(false, Main.BackupPath);
Backup = PopulateData(dgDataBackup, backup); Backup = PopulateData(dgDataBackup, backup);
CB_FilterColumn.Items.Add(MsgAny); CB_FilterColumn.Items.Add(MsgAny);

View file

@ -94,19 +94,21 @@ namespace PKHeX.WinForms
/// <summary> /// <summary>
/// Gets all detectable save files ordered by most recently saved (by file write time). /// Gets all detectable save files ordered by most recently saved (by file write time).
/// </summary> /// </summary>
/// <param name="detect">Detect save files stored in common SD card homebrew locations.</param>
/// <param name="extra">Paths to check in addition to the default paths</param> /// <param name="extra">Paths to check in addition to the default paths</param>
/// <returns>Valid save files, if any.</returns> /// <returns>Valid save files, if any.</returns>
public static IEnumerable<SaveFile> GetSaveFiles(params string[] extra) => GetSaveFiles((IEnumerable<string>)extra); public static IEnumerable<SaveFile> GetSaveFiles(bool detect, params string[] extra) => GetSaveFiles(detect, (IEnumerable<string>)extra);
/// <summary> /// <summary>
/// Gets all detectable save files ordered by most recently saved (by file write time). /// Gets all detectable save files ordered by most recently saved (by file write time).
/// </summary> /// </summary>
/// <param name="detect">Detect save files stored in common SD card homebrew locations.</param>
/// <param name="extra">Paths to check in addition to the default paths</param> /// <param name="extra">Paths to check in addition to the default paths</param>
/// <returns>Valid save files, if any.</returns> /// <returns>Valid save files, if any.</returns>
public static IEnumerable<SaveFile> GetSaveFiles(IEnumerable<string> extra) public static IEnumerable<SaveFile> GetSaveFiles(bool detect, IEnumerable<string> extra)
{ {
var foldersToCheck = GetFoldersToCheck(extra); var paths = detect ? GetFoldersToCheck(extra) : extra;
var result = GetSaveFilePathsFromFolders(foldersToCheck, out var possiblePaths); var result = GetSaveFilePathsFromFolders(paths, out var possiblePaths);
if (!result) if (!result)
return Enumerable.Empty<SaveFile>(); return Enumerable.Empty<SaveFile>();