misc: chore: Use collection expressions in HLE project

This commit is contained in:
Evan Husted
2025-01-26 15:43:02 -06:00
parent 3c2f283ec7
commit 70b767ef60
72 changed files with 312 additions and 299 deletions

View File

@@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
private readonly Ssid _fakeSsid;
private ILdnTcpSocket _tcp;
private LdnProxyUdpServer _udp, _udp2;
private readonly List<LdnProxyTcpSession> _stations = new();
private readonly List<LdnProxyTcpSession> _stations = [];
private readonly Lock _lock = new();
private readonly AutoResetEvent _apConnected = new(false);
@@ -340,10 +340,10 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
if (_protocol.SendBroadcast(_udp, LanPacketType.Scan, DefaultPort) < 0)
{
return Array.Empty<NetworkInfo>();
return [];
}
List<NetworkInfo> outNetworkInfo = new();
List<NetworkInfo> outNetworkInfo = [];
foreach (KeyValuePair<ulong, NetworkInfo> item in _udp.GetScanResults())
{

View File

@@ -162,7 +162,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
public int SendBroadcast(ILdnSocket s, LanPacketType type, int port)
{
return SendPacket(s, type, Array.Empty<byte>(), new IPEndPoint(_discovery.LocalBroadcastAddr, port));
return SendPacket(s, type, [], new IPEndPoint(_discovery.LocalBroadcastAddr, port));
}
public int SendPacket(ILdnSocket s, LanPacketType type, byte[] data, EndPoint endPoint = null)
@@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
private int Compress(byte[] input, out byte[] output)
{
List<byte> outputList = new();
List<byte> outputList = [];
int i = 0;
int maxCount = 0xFF;
@@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
private int Decompress(byte[] input, out byte[] output)
{
List<byte> outputList = new();
List<byte> outputList = [];
int i = 0;
while (i < input.Length && outputList.Count < BufferSize)