fixed path history and the reload button

This commit is contained in:
Luke44565 2024-03-13 18:43:54 -04:00
parent b5562f2014
commit 8282c7b6c6
3 changed files with 20 additions and 27 deletions

View file

@ -191,26 +191,7 @@ namespace Ryujinx.UI.App.Common
return;
}
var fileInfo = new FileInfo(applicationPath);
if ((fileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
{
Console.WriteLine($"Found directory 2: {fileInfo.Name}");
ApplicationData folder = new()
{
TitleName = fileInfo.Name,
FileExtension = "Folder",
Developer = "null",
Path = applicationPath,
Icon = _nsoIcon,
};
OnApplicationAdded(new ApplicationAddedEventArgs
{
AppData = folder,
});
}
long fileSize = fileInfo.Length;
long fileSize = new FileInfo(applicationPath).Length;
string titleName = "Unknown";
string titleId = "0000000000000000";
string developer = "Unknown";

View file

@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private const int HotKeyPressDelayMs = 500;
private ObservableCollection<ApplicationData> _applications;
private readonly Queue<string> _pathHistory;
private readonly Stack<string> _pathHistory;
private string _aspectStatusText;
private string _loadHeading;
@ -122,7 +122,7 @@ namespace Ryujinx.Ava.UI.ViewModels
.Bind(out _appsObservableList).AsObservableList();
_rendererWaitEvent = new AutoResetEvent(false);
_pathHistory = new Queue<string>();
_pathHistory = new Stack<string>();
if (Program.PreviewerDetached)
{
@ -217,6 +217,8 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
public Stack<string> PathHistory => _pathHistory;
public bool IsPaused
{
get => _isPaused;
@ -1296,7 +1298,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public void OpenFolder(string path)
{
_pathHistory.Enqueue(path);
_pathHistory.Push(path);
IsInFolder = _pathHistory.Count != 0;
Applications.Clear();
@ -1309,7 +1311,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{
if (_pathHistory.Count != 0)
{
string path = _pathHistory.Dequeue();
_pathHistory.Pop();
Applications.Clear();
if (_pathHistory.Count == 0)
{
@ -1317,8 +1319,8 @@ namespace Ryujinx.Ava.UI.ViewModels
}
else
{
List<string> SearchPaths = new List<string>();
SearchPaths.Add(path);
List<string> SearchPaths = new();
SearchPaths.Add(_pathHistory.Peek());
ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language);
}
}

View file

@ -23,6 +23,7 @@ using Ryujinx.UI.Common;
using Ryujinx.UI.Common.Configuration;
using Ryujinx.UI.Common.Helper;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Versioning;
using System.Threading;
@ -542,7 +543,16 @@ namespace Ryujinx.Ava.UI.Windows
Thread applicationLibraryThread = new(() =>
{
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
if (ViewModel.IsInFolder)
{
List<string> SearchPaths = new();
SearchPaths.Add(ViewModel.PathHistory.Peek());
ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language);
}
else
{
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
}
_isLoading = false;
})