diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs index 4bcbb993e..987052fad 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs @@ -294,7 +294,7 @@ namespace Ryujinx.UI.App.Common catch (FileNotFoundException) { Logger.Warning?.Print(LogClass.Application, $"The file was not found: '{applicationPath}'"); - + return false; } @@ -492,7 +492,7 @@ namespace Ryujinx.UI.App.Common return true; } - + public bool TryGetDownloadableContentFromFile(string filePath, out List titleUpdates) { titleUpdates = []; @@ -511,9 +511,9 @@ namespace Ryujinx.UI.App.Common IntegrityCheckLevel checkLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None; - + using IFileSystem pfs = PartitionFileSystemUtils.OpenApplicationFileSystem(filePath, _virtualFileSystem); - + foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca")) { using var ncaFile = new UniqueRef(); @@ -554,7 +554,7 @@ namespace Ryujinx.UI.App.Common } return false; } - + public bool TryGetTitleUpdatesFromFile(string filePath, out List titleUpdates) { titleUpdates = []; @@ -579,7 +579,7 @@ namespace Ryujinx.UI.App.Common Dictionary updates = pfs.GetContentData(ContentMetaType.Patch, _virtualFileSystem, checkLevel); - + if (updates.Count == 0) { return false; @@ -609,7 +609,7 @@ namespace Ryujinx.UI.App.Common titleUpdates.Add(update); } } - + return true; } } @@ -737,7 +737,7 @@ namespace Ryujinx.UI.App.Common AppData = application, }); } - + _applications.Edit(it => { foreach (var application in applications) @@ -783,7 +783,7 @@ namespace Ryujinx.UI.App.Common _downloadableContents.Edit(it => { it.Clear(); - + foreach (ApplicationData application in Applications.Items) { var res = DownloadableContentsHelper.LoadDownloadableContentsJson(_virtualFileSystem, application.IdBase); @@ -791,18 +791,18 @@ namespace Ryujinx.UI.App.Common } }); } - + public void SaveDownloadableContentsForGame(ApplicationData application, List<(DownloadableContentModel, bool IsEnabled)> dlcs) { _downloadableContents.Edit(it => { DownloadableContentsHelper.SaveDownloadableContentsJson(_virtualFileSystem, application.IdBase, dlcs); - + it.Remove(it.Items.Where(item => item.Dlc.TitleIdBase == application.IdBase)); it.AddOrUpdate(dlcs); }); } - + // public void LoadTitleUpdates() // { // @@ -812,7 +812,7 @@ namespace Ryujinx.UI.App.Common { _cancellationToken = new CancellationTokenSource(); _downloadableContents.Clear(); - + // Builds the applications list with paths to found applications List applicationPaths = new(); @@ -837,7 +837,8 @@ namespace Ryujinx.UI.App.Common { EnumerationOptions options = new() { - RecurseSubdirectories = true, IgnoreInaccessible = false, + RecurseSubdirectories = true, + IgnoreInaccessible = false, }; IEnumerable files = Directory.EnumerateFiles(appDir, "*", options).Where( @@ -896,7 +897,7 @@ namespace Ryujinx.UI.App.Common DownloadableContent = downloadableContent, }); } - + _downloadableContents.Edit(it => { foreach (var downloadableContent in downloadableContents) @@ -918,7 +919,7 @@ namespace Ryujinx.UI.App.Common { _cancellationToken = new CancellationTokenSource(); _titleUpdates.Clear(); - + // Builds the applications list with paths to found applications List applicationPaths = new(); @@ -943,7 +944,8 @@ namespace Ryujinx.UI.App.Common { EnumerationOptions options = new() { - RecurseSubdirectories = true, IgnoreInaccessible = false, + RecurseSubdirectories = true, + IgnoreInaccessible = false, }; IEnumerable files = Directory.EnumerateFiles(appDir, "*", options) @@ -1003,7 +1005,7 @@ namespace Ryujinx.UI.App.Common TitleUpdate = titleUpdate, }); } - + _titleUpdates.Edit(it => { foreach (var titleUpdate in titleUpdates) @@ -1030,12 +1032,12 @@ namespace Ryujinx.UI.App.Common { ApplicationCountUpdated?.Invoke(null, e); } - + protected void OnTitleUpdateAdded(TitleUpdateAddedEventArgs e) { TitleUpdateAdded?.Invoke(null, e); } - + protected void OnDownloadableContentAdded(DownloadableContentAddedEventArgs e) { DownloadableContentAdded?.Invoke(null, e); @@ -1357,7 +1359,7 @@ namespace Ryujinx.UI.App.Common return false; } - + private Nca TryOpenNca(IStorage ncaStorage) { try diff --git a/src/Ryujinx.UI.Common/Helper/DownloadableContentsHelper.cs b/src/Ryujinx.UI.Common/Helper/DownloadableContentsHelper.cs index 31cc757e5..940dd576f 100644 --- a/src/Ryujinx.UI.Common/Helper/DownloadableContentsHelper.cs +++ b/src/Ryujinx.UI.Common/Helper/DownloadableContentsHelper.cs @@ -19,7 +19,7 @@ namespace Ryujinx.UI.Common.Helper public static class DownloadableContentsHelper { private static readonly DownloadableContentJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions()); - + public static List<(DownloadableContentModel, bool IsEnabled)> LoadDownloadableContentsJson(VirtualFileSystem vfs, ulong applicationIdBase) { // _downloadableContentJsonPath = Path.Combine(AppDataManager.GamesDirPath, applicationData.IdBaseString, "dlc.json"); @@ -86,7 +86,7 @@ namespace Ryujinx.UI.Common.Helper private static List<(DownloadableContentModel, bool IsEnabled)> LoadDownloadableContents(VirtualFileSystem vfs, List downloadableContentContainers) { var result = new List<(DownloadableContentModel, bool IsEnabled)>(); - + foreach (DownloadableContentContainer downloadableContentContainer in downloadableContentContainers) { if (!File.Exists(downloadableContentContainer.ContainerPath)) @@ -127,7 +127,7 @@ namespace Ryujinx.UI.Common.Helper return result; } - + private static Nca TryOpenNca(VirtualFileSystem vfs, IStorage ncaStorage) { try diff --git a/src/Ryujinx/UI/Helpers/DownloadableContentLabelConverter.cs b/src/Ryujinx/UI/Helpers/DownloadableContentLabelConverter.cs index 0ef63e490..22193b97e 100644 --- a/src/Ryujinx/UI/Helpers/DownloadableContentLabelConverter.cs +++ b/src/Ryujinx/UI/Helpers/DownloadableContentLabelConverter.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Ava.UI.Helpers { return BindingOperations.DoNothing; } - + if (values.Count != 2 || !targetType.IsAssignableFrom(typeof(string))) { return null; @@ -29,7 +29,7 @@ namespace Ryujinx.Ava.UI.Helpers { return null; } - + return isBundled ? $"{LocaleManager.Instance[LocaleKeys.TitleBundledDlcLabel]} {label}" : label; } diff --git a/src/Ryujinx/UI/Helpers/TitleUpdateLabelConverter.cs b/src/Ryujinx/UI/Helpers/TitleUpdateLabelConverter.cs index f454d7620..cbb6edff1 100644 --- a/src/Ryujinx/UI/Helpers/TitleUpdateLabelConverter.cs +++ b/src/Ryujinx/UI/Helpers/TitleUpdateLabelConverter.cs @@ -12,14 +12,14 @@ namespace Ryujinx.Ava.UI.Helpers internal class TitleUpdateLabelConverter : IMultiValueConverter { public static TitleUpdateLabelConverter Instance = new(); - + public object Convert(IList values, Type targetType, object parameter, CultureInfo culture) { if (values.Any(it => it is UnsetValueType)) { return BindingOperations.DoNothing; } - + if (values.Count != 2 || !targetType.IsAssignableFrom(typeof(string))) { return null; @@ -29,7 +29,7 @@ namespace Ryujinx.Ava.UI.Helpers { return null; } - + var key = isBundled ? LocaleKeys.TitleBundledUpdateVersionLabel : LocaleKeys.TitleUpdateVersionLabel; return LocaleManager.Instance.UpdateAndGetDynamicValue(key, label); } diff --git a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs index e0df5401e..dcfe57d4e 100644 --- a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs @@ -134,12 +134,12 @@ namespace Ryujinx.Ava.UI.ViewModels foreach ((DownloadableContentModel dlc, bool isEnabled) in _applicationLibrary.DownloadableContents.Items.Where(it => it.Dlc.TitleIdBase == _applicationData.IdBase)) { DownloadableContents.Add(dlc); - + if (isEnabled) { SelectedDownloadableContents.Add(dlc); } - + OnPropertyChanged(nameof(UpdateCount)); } @@ -163,12 +163,12 @@ namespace Ryujinx.Ava.UI.ViewModels _views.Clear(); _views.AddRange(view); - + foreach (DownloadableContentModel item in items) { SelectedDownloadableContents.ReplaceOrAdd(item, item); } - + OnPropertyChanged(nameof(Views)); } @@ -291,7 +291,7 @@ namespace Ryujinx.Ava.UI.ViewModels { SelectedDownloadableContents.ReplaceOrAdd(model, model); } - + public void Disable(DownloadableContentModel model) { SelectedDownloadableContents.Remove(model); diff --git a/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs b/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs index 605bf6aee..1af455201 100644 --- a/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs @@ -22,10 +22,10 @@ using Path = System.IO.Path; namespace Ryujinx.Ava.UI.ViewModels { public record TitleUpdateViewNoUpdateSentinal(); - + public class TitleUpdateViewModel : BaseModel { - + public TitleUpdateMetadata TitleUpdateWindowData; public readonly string TitleUpdateJsonPath; private VirtualFileSystem VirtualFileSystem { get; } @@ -146,7 +146,7 @@ namespace Ryujinx.Ava.UI.ViewModels { return; } - + try { if (!ApplicationLibrary.TryGetTitleUpdatesFromFile(path, out var titleUpdates)) @@ -175,7 +175,8 @@ namespace Ryujinx.Ava.UI.ViewModels Dispatcher.UIThread.InvokeAsync(() => SelectedUpdate = titleUpdate); } } - } catch (Exception ex) + } + catch (Exception ex) { Dispatcher.UIThread.InvokeAsync(() => ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogLoadFileErrorMessage, ex.Message, path))); } diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index dd2b6a14a..41e007c16 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -149,7 +149,7 @@ namespace Ryujinx.Ava.UI.Windows var it = e.DownloadableContent; Console.WriteLine("[{0}]: {1} ({2})", it.TitleIdBase, it.ContainerPath, it.FullPath); } - + private void ApplicationLibrary_TitleUpdateAdded(object sender, TitleUpdateAddedEventArgs e) { var it = e.TitleUpdate; @@ -664,7 +664,7 @@ namespace Ryujinx.Ava.UI.Windows }; applicationLibraryThread.Start(); } - + private static void TimeIt(string tag, Action act) { var watch = System.Diagnostics.Stopwatch.StartNew();