0
0
Fork 0

"Find" method should be used instead of the "FirstOrDefault" extension (#5344)

This commit is contained in:
Marco Carvalho 2023-06-22 20:42:23 -03:00 committed by GitHub
parent 7608cb37ab
commit efbd29463d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 7 deletions

View file

@ -264,7 +264,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private void SelectLastScannedAmiibo()
{
AmiiboApi scanned = _amiiboList.FirstOrDefault(amiibo => amiibo.GetId() == LastScannedAmiiboId);
AmiiboApi scanned = _amiiboList.Find(amiibo => amiibo.GetId() == LastScannedAmiiboId);
SeriesSelectedIndex = AmiiboSeries.IndexOf(scanned.AmiiboSeries);
AmiiboSelectedIndex = AmiiboList.IndexOf(scanned);
@ -325,7 +325,7 @@ namespace Ryujinx.Ava.UI.ViewModels
AmiiboApi selected = _amiibos[_amiiboSelectedIndex];
string imageUrl = _amiiboList.FirstOrDefault(amiibo => amiibo.Equals(selected)).Image;
string imageUrl = _amiiboList.Find(amiibo => amiibo.Equals(selected)).Image;
string usageString = "";

View file

@ -8,6 +8,7 @@ using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.Loaders.Executables;
using Ryujinx.Memory;
using System;
using System.Linq;
using static Ryujinx.HLE.HOS.ModLoader;
@ -99,7 +100,7 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions
if (string.IsNullOrWhiteSpace(programName))
{
programName = nacpData.Value.Title.ItemsRo.ToArray().FirstOrDefault(x => x.Name[0] != 0).NameString.ToString();
programName = Array.Find(nacpData.Value.Title.ItemsRo.ToArray(), x => x.Name[0] != 0).NameString.ToString();
}
}

View file

@ -9,6 +9,7 @@ using LibHac.Tools.FsSystem.NcaUtils;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.Loaders.Executables;
using Ryujinx.HLE.Loaders.Processes.Extensions;
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
@ -176,7 +177,7 @@ namespace Ryujinx.HLE.Loaders.Processes
if (string.IsNullOrWhiteSpace(programName))
{
programName = nacpData.Value.Title.ItemsRo.ToArray().FirstOrDefault(x => x.Name[0] != 0).NameString.ToString();
programName = Array.Find(nacpData.Value.Title.ItemsRo.ToArray(), x => x.Name[0] != 0).NameString.ToString();
}
if (nacpData.Value.PresenceGroupId != 0)

View file

@ -6,6 +6,7 @@ using Ryujinx.Cpu;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Loaders.Processes.Extensions;
using Ryujinx.Horizon.Common;
using System;
using System.Linq;
namespace Ryujinx.HLE.Loaders.Processes
@ -59,7 +60,7 @@ namespace Ryujinx.HLE.Loaders.Processes
if (string.IsNullOrWhiteSpace(Name))
{
Name = ApplicationControlProperties.Title.ItemsRo.ToArray().FirstOrDefault(x => x.Name[0] != 0).NameString.ToString();
Name = Array.Find(ApplicationControlProperties.Title.ItemsRo.ToArray(), x => x.Name[0] != 0).NameString.ToString();
}
DisplayVersion = ApplicationControlProperties.DisplayVersionString.ToString();

View file

@ -163,7 +163,7 @@ namespace Ryujinx.Ui.Windows
private void SelectLastScannedAmiibo()
{
bool isSet = _amiiboSeriesComboBox.SetActiveId(_amiiboList.FirstOrDefault(amiibo => amiibo.Head + amiibo.Tail == LastScannedAmiiboId).AmiiboSeries);
bool isSet = _amiiboSeriesComboBox.SetActiveId(_amiiboList.Find(amiibo => amiibo.Head + amiibo.Tail == LastScannedAmiiboId).AmiiboSeries);
isSet = _amiiboCharsComboBox.SetActiveId(LastScannedAmiiboId);
if (isSet == false)
@ -305,7 +305,7 @@ namespace Ryujinx.Ui.Windows
_amiiboImage.Pixbuf = new Gdk.Pixbuf(_amiiboLogoBytes);
string imageUrl = _amiiboList.FirstOrDefault(amiibo => amiibo.Head + amiibo.Tail == _amiiboCharsComboBox.ActiveId).Image;
string imageUrl = _amiiboList.Find(amiibo => amiibo.Head + amiibo.Tail == _amiiboCharsComboBox.ActiveId).Image;
var usageStringBuilder = new StringBuilder();