mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-09 20:29:11 +00:00
Initial Implementation
This commit is contained in:
parent
8354434a37
commit
22d77f03ff
8 changed files with 99 additions and 2 deletions
|
@ -41,6 +41,7 @@ namespace Ryujinx.UI.App.Common
|
||||||
private readonly byte[] _ncaIcon;
|
private readonly byte[] _ncaIcon;
|
||||||
private readonly byte[] _nroIcon;
|
private readonly byte[] _nroIcon;
|
||||||
private readonly byte[] _nsoIcon;
|
private readonly byte[] _nsoIcon;
|
||||||
|
private readonly byte[] _folderIcon;
|
||||||
|
|
||||||
private readonly VirtualFileSystem _virtualFileSystem;
|
private readonly VirtualFileSystem _virtualFileSystem;
|
||||||
private Language _desiredTitleLanguage;
|
private Language _desiredTitleLanguage;
|
||||||
|
@ -58,6 +59,7 @@ namespace Ryujinx.UI.App.Common
|
||||||
_ncaIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NCA.png");
|
_ncaIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NCA.png");
|
||||||
_nroIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NRO.png");
|
_nroIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NRO.png");
|
||||||
_nsoIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NSO.png");
|
_nsoIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NSO.png");
|
||||||
|
_folderIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_Folder.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] GetResourceBytes(string resourceName)
|
private static byte[] GetResourceBytes(string resourceName)
|
||||||
|
@ -113,7 +115,31 @@ namespace Ryujinx.UI.App.Common
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", SearchOption.AllDirectories).Where(file =>
|
IEnumerable<string> folders = Directory.EnumerateDirectories(appDir, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
foreach (string folder in folders)
|
||||||
|
{
|
||||||
|
if (_cancellationToken.Token.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileInfo = new FileInfo(folder);
|
||||||
|
|
||||||
|
var fullPath = fileInfo.ResolveLinkTarget(true)?.FullName ?? fileInfo.FullName;
|
||||||
|
ApplicationData folderData = new()
|
||||||
|
{
|
||||||
|
TitleName = fileInfo.Name,
|
||||||
|
FileExtension = "Folder",
|
||||||
|
Path = fullPath,
|
||||||
|
Icon = _folderIcon,
|
||||||
|
};
|
||||||
|
OnApplicationAdded(new ApplicationAddedEventArgs
|
||||||
|
{
|
||||||
|
AppData = folderData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", SearchOption.TopDirectoryOnly).Where(file =>
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.UI.ShownFileTypes.NSP.Value) ||
|
(Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.UI.ShownFileTypes.NSP.Value) ||
|
||||||
|
@ -163,7 +189,26 @@ namespace Ryujinx.UI.App.Common
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long fileSize = new FileInfo(applicationPath).Length;
|
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;
|
||||||
string titleName = "Unknown";
|
string titleName = "Unknown";
|
||||||
string titleId = "0000000000000000";
|
string titleId = "0000000000000000";
|
||||||
string developer = "Unknown";
|
string developer = "Unknown";
|
||||||
|
|
BIN
src/Ryujinx.UI.Common/Resources/Icon_Folder.png
Normal file
BIN
src/Ryujinx.UI.Common/Resources/Icon_Folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -15,6 +15,7 @@
|
||||||
<None Remove="Resources\Icon_NSO.png" />
|
<None Remove="Resources\Icon_NSO.png" />
|
||||||
<None Remove="Resources\Icon_NSP.png" />
|
<None Remove="Resources\Icon_NSP.png" />
|
||||||
<None Remove="Resources\Icon_XCI.png" />
|
<None Remove="Resources\Icon_XCI.png" />
|
||||||
|
<None Remove="Resources\Icon_Folder.png" />
|
||||||
<None Remove="Resources\Logo_Amiibo.png" />
|
<None Remove="Resources\Logo_Amiibo.png" />
|
||||||
<None Remove="Resources\Logo_Discord.png" />
|
<None Remove="Resources\Logo_Discord.png" />
|
||||||
<None Remove="Resources\Logo_GitHub.png" />
|
<None Remove="Resources\Logo_GitHub.png" />
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
<EmbeddedResource Include="Resources\Icon_NSO.png" />
|
<EmbeddedResource Include="Resources\Icon_NSO.png" />
|
||||||
<EmbeddedResource Include="Resources\Icon_NSP.png" />
|
<EmbeddedResource Include="Resources\Icon_NSP.png" />
|
||||||
<EmbeddedResource Include="Resources\Icon_XCI.png" />
|
<EmbeddedResource Include="Resources\Icon_XCI.png" />
|
||||||
|
<EmbeddedResource Include="Resources\Icon_Folder.png" />
|
||||||
<EmbeddedResource Include="Resources\Logo_Amiibo.png" />
|
<EmbeddedResource Include="Resources\Logo_Amiibo.png" />
|
||||||
<EmbeddedResource Include="Resources\Logo_Ryujinx.png" />
|
<EmbeddedResource Include="Resources\Logo_Ryujinx.png" />
|
||||||
<EmbeddedResource Include="Resources\Logo_Discord_Dark.png" />
|
<EmbeddedResource Include="Resources\Logo_Discord_Dark.png" />
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||||
{
|
{
|
||||||
List,
|
List,
|
||||||
Grid,
|
Grid,
|
||||||
|
Back,
|
||||||
Chip,
|
Chip,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||||
{
|
{
|
||||||
{ Glyph.List, char.ConvertFromUtf32((int)Symbol.List) },
|
{ Glyph.List, char.ConvertFromUtf32((int)Symbol.List) },
|
||||||
{ Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll) },
|
{ Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll) },
|
||||||
|
{ Glyph.Back, char.ConvertFromUtf32((int)Symbol.Back) },
|
||||||
{ Glyph.Chip, char.ConvertFromUtf32(59748) },
|
{ Glyph.Chip, char.ConvertFromUtf32(59748) },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
private const int HotKeyPressDelayMs = 500;
|
private const int HotKeyPressDelayMs = 500;
|
||||||
|
|
||||||
private ObservableCollection<ApplicationData> _applications;
|
private ObservableCollection<ApplicationData> _applications;
|
||||||
|
private Queue<string> _pathHistory;
|
||||||
private string _aspectStatusText;
|
private string _aspectStatusText;
|
||||||
|
|
||||||
private string _loadHeading;
|
private string _loadHeading;
|
||||||
|
@ -120,6 +121,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
.Bind(out _appsObservableList).AsObservableList();
|
.Bind(out _appsObservableList).AsObservableList();
|
||||||
|
|
||||||
_rendererWaitEvent = new AutoResetEvent(false);
|
_rendererWaitEvent = new AutoResetEvent(false);
|
||||||
|
_pathHistory = new Queue<string>();
|
||||||
|
|
||||||
if (Program.PreviewerDetached)
|
if (Program.PreviewerDetached)
|
||||||
{
|
{
|
||||||
|
@ -1281,6 +1283,34 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
ShowConsole = !ShowConsole;
|
ShowConsole = !ShowConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OpenFolder(string path)
|
||||||
|
{
|
||||||
|
_pathHistory.Enqueue(path);
|
||||||
|
Applications.Clear();
|
||||||
|
List<string> SearchPaths = new List<string>();
|
||||||
|
SearchPaths.Add(path);
|
||||||
|
ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NavigateBack()
|
||||||
|
{
|
||||||
|
if (_pathHistory.Count != 0)
|
||||||
|
{
|
||||||
|
string path = _pathHistory.Dequeue();
|
||||||
|
Applications.Clear();
|
||||||
|
if (_pathHistory.Count == 0)
|
||||||
|
{
|
||||||
|
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<string> SearchPaths = new List<string>();
|
||||||
|
SearchPaths.Add(path);
|
||||||
|
ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetListMode()
|
public void SetListMode()
|
||||||
{
|
{
|
||||||
Glyph = Glyph.List;
|
Glyph = Glyph.List;
|
||||||
|
|
|
@ -18,6 +18,19 @@
|
||||||
Margin="0,0,0,5"
|
Margin="0,0,0,5"
|
||||||
Height="35"
|
Height="35"
|
||||||
HorizontalAlignment="Stretch">
|
HorizontalAlignment="Stretch">
|
||||||
|
<Button
|
||||||
|
Width="80"
|
||||||
|
MinWidth="80"
|
||||||
|
Margin="5,2,0,2"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Command="{Binding NavigateBack}">
|
||||||
|
<ui:FontIcon
|
||||||
|
Margin="0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontFamily="avares://FluentAvalonia/Fonts#Symbols"
|
||||||
|
Glyph="{helpers:GlyphValueConverter Back}" />
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
Width="40"
|
Width="40"
|
||||||
MinWidth="40"
|
MinWidth="40"
|
||||||
|
|
|
@ -137,6 +137,11 @@ namespace Ryujinx.Ava.UI.Windows
|
||||||
{
|
{
|
||||||
if (args.Application != null)
|
if (args.Application != null)
|
||||||
{
|
{
|
||||||
|
if (args.Application.FileExtension == "Folder")
|
||||||
|
{
|
||||||
|
ViewModel.OpenFolder(args.Application.Path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
ViewModel.SelectedIcon = args.Application.Icon;
|
ViewModel.SelectedIcon = args.Application.Icon;
|
||||||
|
|
||||||
string path = new FileInfo(args.Application.Path).FullName;
|
string path = new FileInfo(args.Application.Path).FullName;
|
||||||
|
|
Loading…
Reference in a new issue