private static IEnumerable <CustomFolderPath> GetSwitchPaths(IEnumerable <string> drives) { var pathNX = SaveFinder.GetSwitchLocation(drives); if (pathNX == null) { return(Enumerable.Empty <CustomFolderPath>()); } var root = Path.GetPathRoot(pathNX); var paths = SaveFinder.GetSwitchBackupPaths(root); return(paths.Select(z => new CustomFolderPath(z))); }
private static IEnumerable <CustomFolderPath> GetConsolePaths(IEnumerable <string> drives) { var path3DS = SaveFinder.Get3DSLocation(drives); if (path3DS == null) { return(Array.Empty <CustomFolderPath>()); } var root = Path.GetPathRoot(path3DS); if (root == null) { return(Array.Empty <CustomFolderPath>()); } var paths = SaveFinder.Get3DSBackupPaths(root); return(paths.Select(z => new CustomFolderPath(z))); }
private static int ImportSaves(FileSystemClient fsClient, string rootSaveDir) { if (!Directory.Exists(rootSaveDir)) { return(0); } SaveFinder finder = new SaveFinder(); finder.FindSaves(rootSaveDir); foreach (SaveToImport save in finder.Saves) { Result importResult = ImportSave(fsClient, save); if (importResult.IsFailure()) { throw new HorizonResultException(importResult, $"Error importing save {save.Path}"); } } return(finder.Saves.Count); }
public SAV_FolderList(Action <SaveFile> openSaveFile) { InitializeComponent(); OpenSaveFile = openSaveFile; var drives = Environment.GetLogicalDrives(); Paths = GetPathList(drives); dgDataRecent.ContextMenuStrip = GetContextMenu(dgDataRecent); dgDataBackup.ContextMenuStrip = GetContextMenu(dgDataBackup); var recent = SaveFinder.GetSaveFiles(drives, false, Paths.Select(z => z.Path).Where(z => z != Main.BackupPath)); Recent = PopulateData(dgDataRecent, recent); var backup = SaveFinder.GetSaveFiles(drives, false, Main.BackupPath); Backup = PopulateData(dgDataBackup, backup); CB_FilterColumn.Items.Add(MsgAny); var dgv = Recent.Count >= 1 ? dgDataRecent : dgDataBackup; int count = dgv.ColumnCount; for (int i = 0; i < count; i++) { var text = dgv.Columns[i].HeaderText; CB_FilterColumn.Items.Add(text); var tempLabel = new Label { Name = "DGV_" + text, Text = text, Visible = false }; Controls.Add(tempLabel); TempTranslationLabels.Add(tempLabel); } CB_FilterColumn.SelectedIndex = 0; WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); // Update Translated headers for (int i = 0; i < TempTranslationLabels.Count; i++) { var text = TempTranslationLabels[i].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; } // Preprogrammed folders foreach (var loc in Paths) { AddButton(loc.DisplayText, loc.Path); } AddCustomizeButton(); dgDataRecent.DoubleBuffered(true); dgDataBackup.DoubleBuffered(true); CenterToParent(); }