mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 08:56:24 +02:00
Automatically remove invalid dlc and updates as part of auto load (#42)
* Automatically remove invalid dlc and updates as part of auto load Fixed some minor label spacing issues in options dialog Removal of unused variable in input view model * Fixed missing french message for AutoloadDlcAddedMessage
This commit is contained in:
parent
6be8838043
commit
7038a902c3
8 changed files with 109 additions and 43 deletions
|
@ -53,6 +53,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public class MainWindowViewModel : BaseModel
|
||||
{
|
||||
private const int HotKeyPressDelayMs = 500;
|
||||
private delegate int LoadContentFromFolderDelegate(List<string> dirs, out int numRemoved);
|
||||
|
||||
private ObservableCollectionExtended<ApplicationData> _applications;
|
||||
private string _aspectStatusText;
|
||||
|
@ -1280,7 +1281,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
_rendererWaitEvent.Set();
|
||||
}
|
||||
|
||||
private async Task LoadContentFromFolder(LocaleKeys localeMessageKey, Func<List<string>, int> onDirsSelected)
|
||||
private async Task LoadContentFromFolder(LocaleKeys localeMessageAddedKey, LocaleKeys localeMessageRemovedKey, LoadContentFromFolderDelegate onDirsSelected)
|
||||
{
|
||||
var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||
{
|
||||
|
@ -1291,14 +1292,17 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
if (result.Count > 0)
|
||||
{
|
||||
var dirs = result.Select(it => it.Path.LocalPath).ToList();
|
||||
var numAdded = onDirsSelected(dirs);
|
||||
var numAdded = onDirsSelected(dirs, out int numRemoved);
|
||||
|
||||
var msg = string.Format(LocaleManager.Instance[localeMessageKey], numAdded);
|
||||
var msg = String.Join("\r\n", new string[] {
|
||||
string.Format(LocaleManager.Instance[localeMessageRemovedKey], numRemoved),
|
||||
string.Format(LocaleManager.Instance[localeMessageAddedKey], numAdded)
|
||||
});
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await ContentDialogHelper.ShowTextDialog(
|
||||
LocaleManager.Instance[numAdded > 0 ? LocaleKeys.RyujinxConfirm : LocaleKeys.RyujinxInfo],
|
||||
LocaleManager.Instance[numAdded > 0 || numRemoved > 0 ? LocaleKeys.RyujinxConfirm : LocaleKeys.RyujinxInfo],
|
||||
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
|
||||
});
|
||||
}
|
||||
|
@ -1554,12 +1558,18 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
public async Task LoadDlcFromFolder()
|
||||
{
|
||||
await LoadContentFromFolder(LocaleKeys.AutoloadDlcAddedMessage, ApplicationLibrary.AutoLoadDownloadableContents);
|
||||
await LoadContentFromFolder(
|
||||
LocaleKeys.AutoloadDlcAddedMessage,
|
||||
LocaleKeys.AutoloadDlcRemovedMessage,
|
||||
ApplicationLibrary.AutoLoadDownloadableContents);
|
||||
}
|
||||
|
||||
public async Task LoadTitleUpdatesFromFolder()
|
||||
{
|
||||
await LoadContentFromFolder(LocaleKeys.AutoloadUpdateAddedMessage, ApplicationLibrary.AutoLoadTitleUpdates);
|
||||
await LoadContentFromFolder(
|
||||
LocaleKeys.AutoloadUpdateAddedMessage,
|
||||
LocaleKeys.AutoloadUpdateRemovedMessage,
|
||||
ApplicationLibrary.AutoLoadTitleUpdates);
|
||||
}
|
||||
|
||||
public async Task OpenFolder()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue