Add localization; stub out bulk load updates

This commit is contained in:
Jimmy Reichley 2024-08-18 20:08:33 -04:00
parent 50cd3add3f
commit 130135699a
No known key found for this signature in database
GPG key ID: 67715DC5A329803C
3 changed files with 43 additions and 25 deletions

View file

@ -12,6 +12,8 @@
"MenuBarFileOpenFromFile": "_Load Application From File",
"MenuBarFileOpenFromFileError": "No applications found in selected file.",
"MenuBarFileOpenUnpacked": "Load _Unpacked Game",
"MenuBarFileLoadDlcFromFolder": "Load DLC From Folder",
"MenuBarFileLoadTitleUpdatesFromFolder": "Load Title Updates From Folder",
"MenuBarFileOpenEmuFolder": "Open Ryujinx Folder",
"MenuBarFileOpenLogsFolder": "Open Logs Folder",
"MenuBarFileExit": "_Exit",
@ -600,6 +602,8 @@
"DebugLogTooltip": "Prints debug log messages in the console.\n\nOnly use this if specifically instructed by a staff member, as it will make logs difficult to read and worsen emulator performance.",
"LoadApplicationFileTooltip": "Open a file explorer to choose a Switch compatible file to load",
"LoadApplicationFolderTooltip": "Open a file explorer to choose a Switch compatible, unpacked application to load",
"LoadDlcFromFolderTooltip": "Open a file explorer to choose one or more folders to bulk load DLC from",
"LoadTitleUpdatesFromFolderTooltip": "Open a file explorer to choose one or more folders to bulk load title updates from",
"OpenRyujinxFolderTooltip": "Open Ryujinx filesystem folder",
"OpenRyujinxLogsTooltip": "Opens the folder where logs are written to",
"ExitTooltip": "Exit Ryujinx",

View file

@ -1259,6 +1259,29 @@ namespace Ryujinx.Ava.UI.ViewModels
_rendererWaitEvent.Set();
}
private async Task LoadContentFromFolder(LocaleKeys localeMessageKey, Func<List<string>, int> onDirsSelected)
{
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle], AllowMultiple = true,
});
if (result.Count > 0)
{
var dirs = result.Select(it => it.Path.LocalPath).ToList();
var numAdded = onDirsSelected(dirs);
var msg = string.Format(LocaleManager.Instance[localeMessageKey], numAdded);
await Dispatcher.UIThread.InvokeAsync(async () =>
{
await ContentDialogHelper.ShowTextDialog(
LocaleManager.Instance[numAdded > 0 ? LocaleKeys.RyujinxConfirm : LocaleKeys.RyujinxInfo],
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
});
}
}
#endregion
#region PublicMethods
@ -1507,30 +1530,16 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
public async Task BulkLoadDlc()
public async Task LoadDlcFromFolder()
{
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle], AllowMultiple = true,
});
await LoadContentFromFolder(LocaleKeys.AutoloadDlcAddedMessage,
dirs => ApplicationLibrary.AutoLoadDownloadableContents(dirs));
}
if (result.Count > 0)
{
var dirs = result.Select(it => it.Path.LocalPath).ToList();
var numDlcAdded = ApplicationLibrary.AutoLoadDownloadableContents(dirs);
if (numDlcAdded > 0)
{
var msg = string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded);
await Dispatcher.UIThread.InvokeAsync(async () =>
{
await ContentDialogHelper.ShowTextDialog(
LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
});
}
}
public async Task LoadTitleUpdatesFromFolder()
{
await LoadContentFromFolder(LocaleKeys.AutoloadUpdateAddedMessage,
dirs => ApplicationLibrary.AutoLoadTitleUpdates(dirs));
}
public async Task OpenFolder()

View file

@ -35,10 +35,15 @@
IsEnabled="{Binding EnableNonGameRunningControls}"
ToolTip.Tip="{locale:Locale LoadApplicationFolderTooltip}" />
<MenuItem
Command="{Binding BulkLoadDlc}"
Header="Bulk Load DLC"
Command="{Binding LoadDlcFromFolder}"
Header="{locale:Locale MenuBarFileLoadDlcFromFolder}"
IsEnabled="{Binding EnableNonGameRunningControls}"
ToolTip.Tip="This is the tooltip" />
ToolTip.Tip="{locale:Locale LoadDlcFromFolderTooltip}" />
<MenuItem
Command="{Binding LoadTitleUpdatesFromFolder}"
Header="{locale:Locale MenuBarFileLoadTitleUpdatesFromFolder}"
IsEnabled="{Binding EnableNonGameRunningControls}"
ToolTip.Tip="{locale:Locale LoadTitleUpdatesFromFolderTooltip}" />
<MenuItem Header="{locale:Locale MenuBarFileOpenApplet}" IsEnabled="{Binding IsAppletMenuActive}">
<MenuItem
Click="OpenMiiApplet"