mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-12 10:35:14 -05:00
Display autodetected path location better
Autodetect location not stored in a button path will show up as "???"; check the typical homebrew autodetect paths, then display the parent folder eg, Path.Combine(root, "3ds", "Checkpoint", "saves"); shave off "saves" to return X:\3ds\Checkpoint add range checks to label translation
This commit is contained in:
@@ -51,8 +51,10 @@ public SAV_FolderList(Action<SaveFile> openSaveFile)
|
||||
for (int i = 0; i < TempTranslationLabels.Count; i++)
|
||||
{
|
||||
var text = TempTranslationLabels[i].Text;
|
||||
dgDataRecent.Columns[i].HeaderText = text;
|
||||
dgDataBackup.Columns[i].HeaderText = text;
|
||||
if (i < dgDataRecent.ColumnCount)
|
||||
dgDataRecent.Columns[i].HeaderText = text;
|
||||
if (i < dgDataBackup.ColumnCount)
|
||||
dgDataBackup.Columns[i].HeaderText = text;
|
||||
CB_FilterColumn.Items[i+1] = text;
|
||||
}
|
||||
|
||||
@@ -173,7 +175,15 @@ public CustomFolderPath(string path, string display)
|
||||
private string GetParentFolderName(SaveFile first)
|
||||
{
|
||||
var parent = Paths.Find(z => first.FileFolder.StartsWith(z.Path));
|
||||
return parent?.DisplayText ?? "???";
|
||||
if (parent != null)
|
||||
return parent.DisplayText;
|
||||
|
||||
// likely an autodetect location; try to get a decent filename
|
||||
var backups = PathUtilWindows.GetFoldersToCheck(Enumerable.Empty<string>());
|
||||
var path = backups.FirstOrDefault(z => first.FilePath.StartsWith(z));
|
||||
if (path == null)
|
||||
return "???";
|
||||
return Directory.GetParent(path).Name; // trim off the first subfolder of the autodetect location
|
||||
}
|
||||
|
||||
private sealed class SaveList<T> : SortableBindingList<T> { }
|
||||
@@ -344,6 +354,8 @@ private void SetRowFilter()
|
||||
|
||||
private void GetFilterText(DataGridView dg)
|
||||
{
|
||||
if (dg.RowCount == 0)
|
||||
return;
|
||||
var cm = (CurrencyManager)BindingContext[dg.DataSource];
|
||||
cm.SuspendBinding();
|
||||
int column = CB_FilterColumn.SelectedIndex - 1;
|
||||
|
||||
@@ -114,7 +114,7 @@ public static IEnumerable<SaveFile> GetSaveFiles(IEnumerable<string> extra)
|
||||
return byMostRecent.Select(SaveUtil.GetVariantSAV);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetFoldersToCheck(IEnumerable<string> extra)
|
||||
public static IEnumerable<string> GetFoldersToCheck(IEnumerable<string> extra)
|
||||
{
|
||||
var foldersToCheck = extra.Where(f => f?.Length > 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user