UI: Extract the 256x256 thumbnail too when extracting the logo.

This commit is contained in:
Evan Husted 2024-10-10 21:39:50 -05:00
parent 17e259b90e
commit 335eed75ef
2 changed files with 45 additions and 23 deletions

View file

@ -1,6 +1,7 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Platform.Storage;
using LibHac.Fs;
using LibHac.Tools.FsSystem.NcaUtils;
using Ryujinx.Ava.Common;
@ -325,13 +326,29 @@ namespace Ryujinx.Ava.UI.Controls
{
var viewModel = (sender as MenuItem)?.DataContext as MainWindowViewModel;
if (viewModel?.SelectedApplication != null)
if (viewModel?.SelectedApplication is { } selectedApp)
{
await ApplicationHelper.ExtractSection(
viewModel.StorageProvider,
var result = await viewModel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.FolderDialogExtractTitle],
AllowMultiple = false,
});
if (result.Count == 0)
{
return;
}
ApplicationHelper.ExtractSection(
result[0].Path.LocalPath,
NcaSectionType.Logo,
viewModel.SelectedApplication.Path,
viewModel.SelectedApplication.Name);
var iconFile = await result[0].CreateFileAsync(selectedApp.IdString + ".png");
await using var fileStream = await iconFile.OpenWriteAsync();
fileStream.Write(selectedApp.Icon);
}
}