misc: chore: Use collection expressions

This commit is contained in:
KeatonTheBot
2025-03-06 20:46:29 -06:00
parent 4d5757417e
commit e2973a875a
236 changed files with 9843 additions and 7561 deletions
@@ -16,11 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
[Service("bsd:u", false)]
class IClient : IpcService
{
private static readonly List<IPollManager> _pollManagers = new()
{
private static readonly List<IPollManager> _pollManagers =
[
EventFileDescriptorPollManager.Instance,
ManagedSocketPollManager.Instance,
};
ManagedSocketPollManager.Instance
];
private BsdContext _context;
private readonly bool _isPrivileged;
@@ -281,7 +281,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
for (int i = 0; i < eventsByPollManager.Length; i++)
{
eventsByPollManager[i] = new List<PollEvent>();
eventsByPollManager[i] = [];
foreach (PollEvent evnt in events)
{
@@ -377,12 +377,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
events[i] = new PollEvent(pollEventData, fileDescriptor);
}
List<PollEvent> discoveredEvents = new();
List<PollEvent> discoveredEvents = [];
List<PollEvent>[] eventsByPollManager = new List<PollEvent>[_pollManagers.Count];
for (int i = 0; i < eventsByPollManager.Length; i++)
{
eventsByPollManager[i] = new List<PollEvent>();
eventsByPollManager[i] = [];
foreach (PollEvent evnt in events)
{
@@ -19,14 +19,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
[GeneratedRegex(@"^accounts\.nintendo\.com$", RegexOpts)]
private static partial Regex BlockedHost6();
private static readonly Regex[] _blockedHosts = {
private static readonly Regex[] _blockedHosts =
[
BlockedHost1(),
BlockedHost2(),
BlockedHost3(),
BlockedHost4(),
BlockedHost5(),
BlockedHost6(),
};
BlockedHost6()
];
public static bool IsHostBlocked(string host)
{
@@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
continue;
}
string[] entry = line.Split(new[] { ' ', '\t' }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
string[] entry = line.Split([' ', '\t'], StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
// Hosts file example entry:
// 127.0.0.1 localhost loopback
@@ -92,9 +92,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
return new IPHostEntry
{
AddressList = new[] { hostEntry.Value },
AddressList = [hostEntry.Value],
HostName = hostEntry.Key,
Aliases = Array.Empty<string>(),
Aliases = [],
};
}
}