diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index d161644c0..61beda154 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -975,7 +975,7 @@ namespace Ryujinx.Ava private static IHardwareDeviceDriver InitializeAudio() { - List availableBackends = new List + List availableBackends = new() { AudioBackend.SDL2, AudioBackend.SoundIo, diff --git a/src/Ryujinx/Common/ApplicationHelper.cs b/src/Ryujinx/Common/ApplicationHelper.cs index 1c839aaaa..d9870196e 100644 --- a/src/Ryujinx/Common/ApplicationHelper.cs +++ b/src/Ryujinx/Common/ApplicationHelper.cs @@ -144,7 +144,7 @@ namespace Ryujinx.Ava.Common public static void ExtractSection(string destination, NcaSectionType ncaSectionType, string titleFilePath, string titleName, int programIndex = 0) { - CancellationTokenSource cancellationToken = new CancellationTokenSource(); + CancellationTokenSource cancellationToken = new(); UpdateWaitWindow waitingDialog = new( RyujinxApp.FormatTitle(LocaleKeys.DialogNcaExtractionTitle), @@ -171,14 +171,14 @@ namespace Ryujinx.Ava.Common } else { - PartitionFileSystem pfsTemp = new PartitionFileSystem(); + PartitionFileSystem pfsTemp = new(); pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure(); pfs = pfsTemp; } foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca")) { - using UniqueRef ncaFile = new UniqueRef(); + using UniqueRef ncaFile = new(); pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); @@ -244,8 +244,8 @@ namespace Ryujinx.Ava.Common string source = DateTime.Now.ToFileTime().ToString()[10..]; string output = DateTime.Now.ToFileTime().ToString()[10..]; - using UniqueRef uniqueSourceFs = new UniqueRef(ncaFileSystem); - using UniqueRef uniqueOutputFs = new UniqueRef(new LocalFileSystem(destination)); + using UniqueRef uniqueSourceFs = new(ncaFileSystem); + using UniqueRef uniqueOutputFs = new(new LocalFileSystem(destination)); fsClient.Register(source.ToU8Span(), ref uniqueSourceFs.Ref); fsClient.Register(output.ToU8Span(), ref uniqueOutputFs.Ref); @@ -299,7 +299,7 @@ namespace Ryujinx.Ava.Common public static void ExtractAoc(string destination, string updateFilePath, string updateName) { - CancellationTokenSource cancellationToken = new CancellationTokenSource(); + CancellationTokenSource cancellationToken = new(); UpdateWaitWindow waitingDialog = new( RyujinxApp.FormatTitle(LocaleKeys.DialogNcaExtractionTitle), @@ -317,13 +317,13 @@ namespace Ryujinx.Ava.Common string extension = Path.GetExtension(updateFilePath).ToLower(); if (extension is ".nsp") { - PartitionFileSystem pfsTemp = new PartitionFileSystem(); + PartitionFileSystem pfsTemp = new(); pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure(); IFileSystem pfs = pfsTemp; foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca")) { - using UniqueRef ncaFile = new UniqueRef(); + using UniqueRef ncaFile = new(); pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); @@ -364,8 +364,8 @@ namespace Ryujinx.Ava.Common string source = DateTime.Now.ToFileTime().ToString()[10..]; string output = DateTime.Now.ToFileTime().ToString()[10..]; - using UniqueRef uniqueSourceFs = new UniqueRef(ncaFileSystem); - using UniqueRef uniqueOutputFs = new UniqueRef(new LocalFileSystem(destination)); + using UniqueRef uniqueSourceFs = new(ncaFileSystem); + using UniqueRef uniqueOutputFs = new(new LocalFileSystem(destination)); fsClient.Register(source.ToU8Span(), ref uniqueSourceFs.Ref); fsClient.Register(output.ToU8Span(), ref uniqueOutputFs.Ref); diff --git a/src/Ryujinx/Common/LocaleManager.cs b/src/Ryujinx/Common/LocaleManager.cs index 72c2e04c4..e3ff7c78c 100644 --- a/src/Ryujinx/Common/LocaleManager.cs +++ b/src/Ryujinx/Common/LocaleManager.cs @@ -125,7 +125,7 @@ namespace Ryujinx.Ava.Common.Locale private static Dictionary LoadJsonLanguage(string languageCode) { - Dictionary localeStrings = new Dictionary(); + Dictionary localeStrings = new(); _localeData ??= EmbeddedResources.ReadAllText("Ryujinx/Assets/locales.json") .Into(it => JsonHelper.Deserialize(it, LocalesJsonContext.Default.LocalesJson)); diff --git a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs index 7286178e7..da59a5d52 100644 --- a/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs +++ b/src/Ryujinx/Common/Models/XCITrimmerFileModel.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Ava.Common.Models { public static XCITrimmerFileModel FromApplicationData(ApplicationData applicationData, XCIFileTrimmerLog logger) { - XCIFileTrimmer trimmer = new XCIFileTrimmer(applicationData.Path, logger); + XCIFileTrimmer trimmer = new(applicationData.Path, logger); return new XCITrimmerFileModel( applicationData.Name, diff --git a/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs b/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs index 86e9adcd5..c75e532ec 100644 --- a/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs +++ b/src/Ryujinx/UI/Applet/AvaHostUIHandler.cs @@ -172,7 +172,7 @@ namespace Ryujinx.Ava.UI.Applet try { _parent.ViewModel.AppHost.NpadManager.BlockInputUpdates(); - SoftwareKeyboardUIArgs args = new SoftwareKeyboardUIArgs(); + SoftwareKeyboardUIArgs args = new(); args.KeyboardMode = KeyboardMode.Default; args.InitialText = "Ryujinx"; args.StringLengthMin = 1; @@ -264,7 +264,7 @@ namespace Ryujinx.Ava.UI.Applet { UserId selected = UserId.Null; byte[] defaultGuestImage = EmbeddedResources.Read("Ryujinx.HLE/HOS/Services/Account/Acc/GuestUserImage.jpg"); - UserProfile guest = new UserProfile(new UserId("00000000000000000000000000000080"), "Guest", defaultGuestImage); + UserProfile guest = new(new UserId("00000000000000000000000000000080"), "Guest", defaultGuestImage); ManualResetEvent dialogCloseEvent = new(false); diff --git a/src/Ryujinx/UI/Applet/UserSelectorDialog.axaml.cs b/src/Ryujinx/UI/Applet/UserSelectorDialog.axaml.cs index 4081de61e..e27355b9b 100644 --- a/src/Ryujinx/UI/Applet/UserSelectorDialog.axaml.cs +++ b/src/Ryujinx/UI/Applet/UserSelectorDialog.axaml.cs @@ -64,7 +64,7 @@ namespace Ryujinx.Ava.UI.Applet { if (item is UserProfile originalItem) { - UserProfileSft profile = new UserProfileSft(originalItem.UserId, originalItem.Name, originalItem.Image); + UserProfileSft profile = new(originalItem.UserId, originalItem.Name, originalItem.Image); if (profile.UserId == ViewModel.SelectedUserId) { diff --git a/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs b/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs index 1c20aac74..44cd84433 100644 --- a/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs +++ b/src/Ryujinx/UI/Controls/NavigationDialogHost.axaml.cs @@ -108,7 +108,7 @@ namespace Ryujinx.Ava.UI.Controls SaveDataFilter saveDataFilter = SaveDataFilter.Make(programId: default, saveType: SaveDataType.Account, default, saveDataId: default, index: default); - using UniqueRef saveDataIterator = new UniqueRef(); + using UniqueRef saveDataIterator = new(); HorizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref, SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure(); @@ -128,7 +128,7 @@ namespace Ryujinx.Ava.UI.Controls for (int i = 0; i < readCount; i++) { SaveDataInfo save = saveDataInfo[i]; - UserId id = new UserId((long)save.UserId.Id.Low, (long)save.UserId.Id.High); + UserId id = new((long)save.UserId.Id.Low, (long)save.UserId.Id.High); if (ViewModel.Profiles.Cast().FirstOrDefault(x => x.UserId == id) == null) { lostAccounts.Add(id); diff --git a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs index 1dc1adcc5..928d1fc31 100644 --- a/src/Ryujinx/UI/Helpers/LoggerAdapter.cs +++ b/src/Ryujinx/UI/Helpers/LoggerAdapter.cs @@ -50,8 +50,8 @@ namespace Ryujinx.Ava.UI.Helpers private static string Format(AvaLogLevel level, string area, string template, object source, object[] v) { - StringBuilder result = new StringBuilder(); - CharacterReader r = new CharacterReader(template.AsSpan()); + StringBuilder result = new(); + CharacterReader r = new(template.AsSpan()); int i = 0; result.Append('['); diff --git a/src/Ryujinx/UI/Helpers/NotificationHelper.cs b/src/Ryujinx/UI/Helpers/NotificationHelper.cs index aa071a2a1..d4d898687 100644 --- a/src/Ryujinx/UI/Helpers/NotificationHelper.cs +++ b/src/Ryujinx/UI/Helpers/NotificationHelper.cs @@ -28,7 +28,7 @@ namespace Ryujinx.Ava.UI.Helpers Margin = new Thickness(0, 0, 15, 40), }; - Lazy> maybeAsyncWorkQueue = new Lazy>( + Lazy> maybeAsyncWorkQueue = new( () => new AsyncWorkQueue(notification => { Dispatcher.UIThread.Post(() => diff --git a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs index bf3864b93..a71c85eba 100644 --- a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs @@ -367,7 +367,7 @@ namespace Ryujinx.Ava.UI.Models.Input public InputConfig GetConfig() { - StandardKeyboardInputConfig config = new StandardKeyboardInputConfig + StandardKeyboardInputConfig config = new() { Id = Id, Backend = InputBackendType.WindowKeyboard, diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 1f938d313..53e476f59 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -1802,7 +1802,7 @@ namespace Ryujinx.Ava.UI.ViewModels return; } - XCIFileTrimmer trimmer = new XCIFileTrimmer(filename, new XCITrimmerLog.MainWindow(this)); + XCIFileTrimmer trimmer = new(filename, new XCITrimmerLog.MainWindow(this)); if (trimmer.CanBeTrimmed) { diff --git a/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs index 7c465572d..9d817ea0d 100644 --- a/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs @@ -82,13 +82,13 @@ namespace Ryujinx.Ava.UI.ViewModels foreach (string path in modsBasePaths) { bool inSd = path == ModLoader.GetSdModsBasePath(); - ModLoader.ModCache modCache = new ModLoader.ModCache(); + ModLoader.ModCache modCache = new(); ModLoader.QueryContentsDir(modCache, new DirectoryInfo(Path.Combine(path, "contents")), applicationId); foreach (ModLoader.Mod mod in modCache.RomfsDirs) { - ModModel modModel = new ModModel(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd); + ModModel modModel = new(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd); if (Mods.All(x => x.Path != mod.Path.Parent.FullName)) { Mods.Add(modModel); @@ -102,7 +102,7 @@ namespace Ryujinx.Ava.UI.ViewModels foreach (ModLoader.Mod mod in modCache.ExefsDirs) { - ModModel modModel = new ModModel(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd); + ModModel modModel = new(mod.Path.Parent.FullName, mod.Name, mod.Enabled, inSd); if (Mods.All(x => x.Path != mod.Path.Parent.FullName)) { Mods.Add(modModel); diff --git a/src/Ryujinx/UI/ViewModels/UserFirmwareAvatarSelectorViewModel.cs b/src/Ryujinx/UI/ViewModels/UserFirmwareAvatarSelectorViewModel.cs index d0b178e41..33f30dbb0 100644 --- a/src/Ryujinx/UI/ViewModels/UserFirmwareAvatarSelectorViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/UserFirmwareAvatarSelectorViewModel.cs @@ -104,7 +104,7 @@ namespace Ryujinx.Ava.UI.ViewModels // TODO: Parse DatabaseInfo.bin and table.bin files for more accuracy. if (item.Type == DirectoryEntryType.File && item.FullPath.Contains("chara") && item.FullPath.Contains("szs")) { - using UniqueRef file = new UniqueRef(); + using UniqueRef file = new(); romfs.OpenFile(ref file.Ref, ("/" + item.FullPath).ToU8Span(), OpenMode.Read).ThrowIfFailure(); diff --git a/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs b/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs index 60ddb2040..72905ed1b 100644 --- a/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs @@ -183,7 +183,7 @@ namespace Ryujinx.Ava.UI.ViewModels if (cancellationToken.IsCancellationRequested) break; - XCIFileTrimmer trimmer = new XCIFileTrimmer(xciApp.Path, _logger); + XCIFileTrimmer trimmer = new(xciApp.Path, _logger); Dispatcher.UIThread.Post(() => { diff --git a/src/Ryujinx/UI/Views/User/UserFirmwareAvatarSelectorView.axaml.cs b/src/Ryujinx/UI/Views/User/UserFirmwareAvatarSelectorView.axaml.cs index 206926755..fced8dc6f 100644 --- a/src/Ryujinx/UI/Views/User/UserFirmwareAvatarSelectorView.axaml.cs +++ b/src/Ryujinx/UI/Views/User/UserFirmwareAvatarSelectorView.axaml.cs @@ -66,11 +66,11 @@ namespace Ryujinx.Ava.UI.Views.User { if (ViewModel.SelectedImage != null) { - using MemoryStream streamJpg = new MemoryStream(); + using MemoryStream streamJpg = new(); using SKBitmap bitmap = SKBitmap.Decode(ViewModel.SelectedImage); - using SKBitmap newBitmap = new SKBitmap(bitmap.Width, bitmap.Height); + using SKBitmap newBitmap = new(bitmap.Width, bitmap.Height); - using (SKCanvas canvas = new SKCanvas(newBitmap)) + using (SKCanvas canvas = new(newBitmap)) { canvas.Clear(new SKColor( ViewModel.BackgroundColor.R, diff --git a/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs b/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs index 73656e881..5740ffe77 100644 --- a/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs +++ b/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs @@ -103,7 +103,7 @@ namespace Ryujinx.Ava.UI.Views.User SKBitmap resizedBitmap = bitmap.Resize(new SKImageInfo(256, 256), SKFilterQuality.High); - using MemoryStream streamJpg = new MemoryStream(); + using MemoryStream streamJpg = new(); if (resizedBitmap != null) { diff --git a/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs b/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs index 1d9cb10cf..7a221e7b3 100644 --- a/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs +++ b/src/Ryujinx/UI/Views/User/UserSaveManagerView.axaml.cs @@ -67,7 +67,7 @@ namespace Ryujinx.Ava.UI.Views.User public void LoadSaves() { ViewModel.Saves.Clear(); - ObservableCollection saves = new ObservableCollection(); + ObservableCollection saves = new(); SaveDataFilter saveDataFilter = SaveDataFilter.Make( programId: default, saveType: SaveDataType.Account, @@ -75,7 +75,7 @@ namespace Ryujinx.Ava.UI.Views.User saveDataId: default, index: default); - using UniqueRef saveDataIterator = new UniqueRef(); + using UniqueRef saveDataIterator = new(); _horizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref, SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure(); @@ -95,7 +95,7 @@ namespace Ryujinx.Ava.UI.Views.User SaveDataInfo save = saveDataInfo[i]; if (save.ProgramId.Value != 0) { - SaveModel saveModel = new SaveModel(save); + SaveModel saveModel = new(save); saves.Add(saveModel); } } diff --git a/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs b/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs index 3ed27bfe7..71d864c99 100644 --- a/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs @@ -59,7 +59,7 @@ namespace Ryujinx.Ava.UI.Windows int cheatAdded = 0; - ModLoader.ModCache mods = new ModLoader.ModCache(); + ModLoader.ModCache mods = new(); ModLoader.QueryContentsDir(mods, new DirectoryInfo(Path.Combine(modsBasePath, "contents")), titleIdValue); @@ -81,7 +81,7 @@ namespace Ryujinx.Ava.UI.Windows LoadedCheats.Add(currentGroup); } - CheatNode model = new CheatNode(cheat.Name, buildId, string.Empty, false, enabled.Contains($"{buildId}-{cheat.Name}")); + CheatNode model = new(cheat.Name, buildId, string.Empty, false, enabled.Contains($"{buildId}-{cheat.Name}")); currentGroup?.SubNodes.Add(model); cheatAdded++; diff --git a/src/Ryujinx/UI/Windows/IconColorPicker.cs b/src/Ryujinx/UI/Windows/IconColorPicker.cs index 78ad8562f..ca9ac2c05 100644 --- a/src/Ryujinx/UI/Windows/IconColorPicker.cs +++ b/src/Ryujinx/UI/Windows/IconColorPicker.cs @@ -50,7 +50,7 @@ namespace Ryujinx.Ava.UI.Windows public static SKColor GetColor(SKBitmap image) { PaletteColor[] colors = new PaletteColor[TotalColors]; - Dictionary dominantColorBin = new Dictionary(); + Dictionary dominantColorBin = new(); SKColor[] buffer = GetBuffer(image); diff --git a/src/Ryujinx/Utilities/AppLibrary/ApplicationData.cs b/src/Ryujinx/Utilities/AppLibrary/ApplicationData.cs index 5649addab..98c879df3 100644 --- a/src/Ryujinx/Utilities/AppLibrary/ApplicationData.cs +++ b/src/Ryujinx/Utilities/AppLibrary/ApplicationData.cs @@ -76,14 +76,14 @@ namespace Ryujinx.Ava.Utilities.AppLibrary } else { - PartitionFileSystem pfsTemp = new PartitionFileSystem(); + PartitionFileSystem pfsTemp = new(); pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure(); pfs = pfsTemp; } foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca")) { - using UniqueRef ncaFile = new UniqueRef(); + using UniqueRef ncaFile = new(); pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); @@ -158,7 +158,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary return string.Empty; } - using UniqueRef nsoFile = new UniqueRef(); + using UniqueRef nsoFile = new(); codeFs.OpenFile(ref nsoFile.Ref, $"/{MainExeFs}".ToU8Span(), OpenMode.Read).ThrowIfFailure(); diff --git a/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs b/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs index 7a66fe44d..1720cd7f5 100644 --- a/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs +++ b/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs @@ -190,7 +190,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary /// An error occured while reading PFS data. private List GetApplicationsFromPfs(IFileSystem pfs, string filePath) { - List applications = new List(); + List applications = new(); string extension = Path.GetExtension(filePath).ToLower(); foreach ((ulong titleId, ContentMetaData content) in pfs.GetContentData(ContentMetaType.Application, _virtualFileSystem, _checkLevel)) @@ -245,7 +245,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary continue; } - using UniqueRef icon = new UniqueRef(); + using UniqueRef icon = new(); controlFs.OpenFile(ref icon.Ref, entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); @@ -313,7 +313,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary case ".nsp": case ".pfs0": { - PartitionFileSystem pfs = new PartitionFileSystem(); + PartitionFileSystem pfs = new(); pfs.Initialize(file.AsStorage()).ThrowIfFailure(); ApplicationData result = GetApplicationFromNsp(pfs, applicationPath); @@ -501,7 +501,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca")) { - using UniqueRef ncaFile = new UniqueRef(); + using UniqueRef ncaFile = new(); pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); @@ -589,7 +589,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary ReadOption.None).ThrowIfFailure(); string displayVersion = controlData.DisplayVersionString.ToString(); - TitleUpdateModel update = new TitleUpdateModel(content.ApplicationId, content.Version.Version, + TitleUpdateModel update = new(content.ApplicationId, content.Version.Version, displayVersion, filePath); titleUpdates.Add(update); @@ -685,7 +685,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary return; } - FileInfo fileInfo = new FileInfo(app); + FileInfo fileInfo = new(app); try { @@ -776,7 +776,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary ldnWebHost = DefaultLanPlayWebHost; } IEnumerable ldnGameDataArray = Array.Empty(); - using HttpClient httpClient = new HttpClient(); + using HttpClient httpClient = new(); string ldnGameDataArrayString = await httpClient.GetStringAsync($"https://{ldnWebHost}/api/public_games"); ldnGameDataArray = JsonHelper.Deserialize(ldnGameDataArrayString, _ldnDataSerializerContext.IEnumerableLdnGameData); LdnGameDataReceived?.Invoke(new LdnGameDataReceivedEventArgs @@ -882,7 +882,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary return newDlcLoaded; } - FileInfo fileInfo = new FileInfo(app); + FileInfo fileInfo = new(app); try { @@ -949,8 +949,8 @@ namespace Ryujinx.Ava.Utilities.AppLibrary try { - HashSet titleIdsToSave = new HashSet(); - HashSet titleIdsToRefresh = new HashSet(); + HashSet titleIdsToSave = new(); + HashSet titleIdsToRefresh = new(); // Remove any updates which can no longer be located on disk List<(TitleUpdateModel TitleUpdate, bool IsSelected)> updatesToRemove = _titleUpdates.Items @@ -998,7 +998,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary return numUpdatesLoaded; } - FileInfo fileInfo = new FileInfo(app); + FileInfo fileInfo = new(app); try { @@ -1170,7 +1170,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary } else { - PartitionFileSystem pfsTemp = new PartitionFileSystem(); + PartitionFileSystem pfsTemp = new(); pfsTemp.Initialize(file.AsStorage()).ThrowIfFailure(); pfs = pfsTemp; @@ -1204,7 +1204,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary // Read the icon from the ControlFS and store it as a byte array try { - using UniqueRef icon = new UniqueRef(); + using UniqueRef icon = new(); controlFs.OpenFile(ref icon.Ref, $"/icon_{desiredTitleLanguage}.dat".ToU8Span(), OpenMode.Read).ThrowIfFailure(); @@ -1222,7 +1222,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary continue; } - using UniqueRef icon = new UniqueRef(); + using UniqueRef icon = new(); controlFs.OpenFile(ref icon.Ref, entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); diff --git a/src/Ryujinx/Utilities/DownloadableContentsHelper.cs b/src/Ryujinx/Utilities/DownloadableContentsHelper.cs index b8af11527..e46d1498a 100644 --- a/src/Ryujinx/Utilities/DownloadableContentsHelper.cs +++ b/src/Ryujinx/Utilities/DownloadableContentsHelper.cs @@ -82,7 +82,7 @@ namespace Ryujinx.Ava.Utilities private static List<(DownloadableContentModel, bool IsEnabled)> LoadDownloadableContents(VirtualFileSystem vfs, List downloadableContentContainers) { - List<(DownloadableContentModel, bool IsEnabled)> result = new List<(DownloadableContentModel, bool IsEnabled)>(); + List<(DownloadableContentModel, bool IsEnabled)> result = new(); foreach (DownloadableContentContainer downloadableContentContainer in downloadableContentContainers) { @@ -105,7 +105,7 @@ namespace Ryujinx.Ava.Utilities continue; } - DownloadableContentModel content = new DownloadableContentModel(nca.Header.TitleId, + DownloadableContentModel content = new(nca.Header.TitleId, downloadableContentContainer.ContainerPath, downloadableContentNca.FullPath); diff --git a/src/Ryujinx/Utilities/ShortcutHelper.cs b/src/Ryujinx/Utilities/ShortcutHelper.cs index 5a5f92773..ff89725d8 100644 --- a/src/Ryujinx/Utilities/ShortcutHelper.cs +++ b/src/Ryujinx/Utilities/ShortcutHelper.cs @@ -124,7 +124,7 @@ namespace Ryujinx.Ava.Utilities private static string GetArgsString(string appFilePath, string applicationId) { // args are first defined as a list, for easier adjustments in the future - List argsList = new List(); + List argsList = new(); if (!string.IsNullOrEmpty(CommandLineState.BaseDirPathArg)) { diff --git a/src/Ryujinx/Utilities/SystemInfo/LinuxSystemInfo.cs b/src/Ryujinx/Utilities/SystemInfo/LinuxSystemInfo.cs index fa2f8bf71..4fa09e925 100644 --- a/src/Ryujinx/Utilities/SystemInfo/LinuxSystemInfo.cs +++ b/src/Ryujinx/Utilities/SystemInfo/LinuxSystemInfo.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Ava.Utilities.SystemInfo if (cpuName == null) { - Dictionary cpuDict = new Dictionary(StringComparer.Ordinal) + Dictionary cpuDict = new(StringComparer.Ordinal) { ["model name"] = null, ["Processor"] = null, @@ -28,7 +28,7 @@ namespace Ryujinx.Ava.Utilities.SystemInfo cpuName = cpuDict["model name"] ?? cpuDict["Processor"] ?? cpuDict["Hardware"] ?? "Unknown"; } - Dictionary memDict = new Dictionary(StringComparer.Ordinal) + Dictionary memDict = new(StringComparer.Ordinal) { ["MemTotal"] = null, ["MemAvailable"] = null, diff --git a/src/Ryujinx/Utilities/TitleUpdatesHelper.cs b/src/Ryujinx/Utilities/TitleUpdatesHelper.cs index 805d6a46a..fd3bb641c 100644 --- a/src/Ryujinx/Utilities/TitleUpdatesHelper.cs +++ b/src/Ryujinx/Utilities/TitleUpdatesHelper.cs @@ -51,7 +51,7 @@ namespace Ryujinx.Ava.Utilities public static void SaveTitleUpdatesJson(ulong applicationIdBase, List<(TitleUpdateModel, bool IsSelected)> updates) { - TitleUpdateMetadata titleUpdateWindowData = new TitleUpdateMetadata + TitleUpdateMetadata titleUpdateWindowData = new() { Selected = string.Empty, Paths = [], @@ -79,7 +79,7 @@ namespace Ryujinx.Ava.Utilities private static List<(TitleUpdateModel Update, bool IsSelected)> LoadTitleUpdates(VirtualFileSystem vfs, TitleUpdateMetadata titleUpdateMetadata, ulong applicationIdBase) { - List<(TitleUpdateModel, bool IsSelected)> result = new List<(TitleUpdateModel, bool IsSelected)>(); + List<(TitleUpdateModel, bool IsSelected)> result = new(); IntegrityCheckLevel checkLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid @@ -116,7 +116,7 @@ namespace Ryujinx.Ava.Utilities .ThrowIfFailure(); string displayVersion = controlData.DisplayVersionString.ToString(); - TitleUpdateModel update = new TitleUpdateModel(content.ApplicationId, content.Version.Version, + TitleUpdateModel update = new(content.ApplicationId, content.Version.Version, displayVersion, path); result.Add((update, path == titleUpdateMetadata.Selected));