mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 10:37:11 +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()
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
</CheckBox>
|
||||
</StackPanel>
|
||||
<Separator Height="1" />
|
||||
<StackPanel Orientation="Vertical" Spacing="2">
|
||||
<StackPanel Orientation="Vertical" Spacing="5">
|
||||
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabLoggingDeveloperOptions}" />
|
||||
<TextBlock Foreground="{DynamicResource SecondaryTextColor}" Text="{locale:Locale SettingsTabLoggingDeveloperOptionsNote}" />
|
||||
</StackPanel>
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
<Separator Height="1" />
|
||||
<StackPanel
|
||||
Orientation="Vertical"
|
||||
Spacing="2">
|
||||
Spacing="5">
|
||||
<TextBlock
|
||||
Classes="h1"
|
||||
Text="{locale:Locale SettingsTabSystemHacks}" />
|
||||
|
|
|
@ -129,7 +129,10 @@
|
|||
</Grid>
|
||||
</StackPanel>
|
||||
<Separator Height="1" />
|
||||
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabGeneralAutoloadDirectories}" />
|
||||
<StackPanel Orientation="Vertical" Spacing="5">
|
||||
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabGeneralAutoloadDirectories}" />
|
||||
<TextBlock Foreground="{DynamicResource SecondaryTextColor}" Text="{locale:Locale SettingsTabGeneralAutoloadNote}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
|
@ -137,7 +140,7 @@
|
|||
Spacing="10">
|
||||
<ListBox
|
||||
Name="AutoloadDirsList"
|
||||
MinHeight="120"
|
||||
MinHeight="100"
|
||||
ItemsSource="{Binding AutoloadDirectories}">
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
|
|
|
@ -633,10 +633,10 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
var autoloadDirs = ConfigurationState.Instance.UI.AutoloadDirs.Value;
|
||||
if (autoloadDirs.Count > 0)
|
||||
{
|
||||
var updatesLoaded = ApplicationLibrary.AutoLoadTitleUpdates(autoloadDirs);
|
||||
var dlcLoaded = ApplicationLibrary.AutoLoadDownloadableContents(autoloadDirs);
|
||||
var updatesLoaded = ApplicationLibrary.AutoLoadTitleUpdates(autoloadDirs, out int updatesRemoved);
|
||||
var dlcLoaded = ApplicationLibrary.AutoLoadDownloadableContents(autoloadDirs, out int dlcRemoved);
|
||||
|
||||
ShowNewContentAddedDialog(dlcLoaded, updatesLoaded);
|
||||
ShowNewContentAddedDialog(dlcLoaded, dlcRemoved, updatesLoaded, updatesRemoved);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
|
@ -648,20 +648,20 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
applicationLibraryThread.Start();
|
||||
}
|
||||
|
||||
private void ShowNewContentAddedDialog(int numDlcAdded, int numUpdatesAdded)
|
||||
private void ShowNewContentAddedDialog(int numDlcAdded, int numDlcRemoved, int numUpdatesAdded, int numUpdatesRemoved)
|
||||
{
|
||||
string msg = numDlcAdded > 0 && numUpdatesAdded > 0
|
||||
? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAndUpdateAddedMessage], numDlcAdded, numUpdatesAdded)
|
||||
: numDlcAdded > 0
|
||||
? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded)
|
||||
: numUpdatesAdded > 0
|
||||
? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadUpdateAddedMessage], numUpdatesAdded)
|
||||
: null;
|
||||
string[] messages = {
|
||||
numDlcRemoved > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcRemovedMessage], numDlcRemoved): null,
|
||||
numDlcAdded > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded): null,
|
||||
numUpdatesRemoved > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadUpdateRemovedMessage], numUpdatesRemoved): null,
|
||||
numUpdatesAdded > 0 ? string.Format(LocaleManager.Instance[LocaleKeys.AutoloadUpdateAddedMessage], numUpdatesAdded) : null
|
||||
};
|
||||
|
||||
if (msg is null)
|
||||
string msg = String.Join("\r\n", messages);
|
||||
|
||||
if (String.IsNullOrWhiteSpace(msg))
|
||||
return;
|
||||
|
||||
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await ContentDialogHelper.ShowTextDialog(LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue