misc: chore: Use collection expressions (part 2)

This commit is contained in:
KeatonTheBot
2025-03-10 21:32:01 -05:00
parent c923c0043a
commit 340ec79e9f
176 changed files with 308 additions and 308 deletions
@@ -53,7 +53,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
ProfilesJson profilesJson = new()
{
Profiles = new List<UserProfileJson>(),
Profiles = [],
LastOpened = LastOpened.ToString(),
};
@@ -852,8 +852,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid
// Initialize entries to avoid issues with some games.
List<GamepadInput> emptyGamepadInputs = new();
List<SixAxisInput> emptySixAxisInputs = new();
List<GamepadInput> emptyGamepadInputs = [];
List<SixAxisInput> emptySixAxisInputs = [];
for (int player = 0; player < NpadDevices.MaxControllers; player++)
{
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
{
private const ushort EphemeralBase = 49152;
private readonly List<ushort> _ephemeralPorts = new List<ushort>();
private readonly List<ushort> _ephemeralPorts = [];
private readonly Lock _lock = new();
@@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
public EndPoint LocalEndpoint { get; }
public IPAddress LocalAddress { get; }
private readonly List<LdnProxySocket> _sockets = new List<LdnProxySocket>();
private readonly List<LdnProxySocket> _sockets = [];
private readonly Dictionary<ProtocolType, EphemeralPortPool> _ephemeralPorts = new Dictionary<ProtocolType, EphemeralPortPool>();
private readonly IProxyClient _parent;
@@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
private readonly LdnProxy _proxy;
private bool _isListening;
private readonly List<LdnProxySocket> _listenSockets = new List<LdnProxySocket>();
private readonly List<LdnProxySocket> _listenSockets = [];
private readonly Queue<ProxyConnectRequest> _connectRequests = new Queue<ProxyConnectRequest>();
@@ -39,9 +39,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
private NatDevice _natDevice;
private Mapping _portMapping;
private readonly List<P2pProxySession> _players = new List<P2pProxySession>();
private readonly List<P2pProxySession> _players = [];
private readonly List<ExternalProxyToken> _waitingTokens = new List<ExternalProxyToken>();
private readonly List<ExternalProxyToken> _waitingTokens = [];
private readonly AutoResetEvent _tokenEvent = new AutoResetEvent(false);
private uint _broadcastAddress;
@@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
private byte[] DeriveKey(AmiiboMasterKey key, bool deriveAes, out byte[] derivedAesKey, out byte[] derivedAesIv)
{
List<byte> seed = new List<byte>();
List<byte> seed = [];
// Start with the type string (14 bytes)
seed.AddRange(key.TypeString);
@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.GeneralService
{
static class GeneralServiceManager
{
private static readonly List<GeneralServiceDetail> _generalServices = new();
private static readonly List<GeneralServiceDetail> _generalServices = [];
public static int Count
{
@@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns.Aoc
private ulong _addOnContentBaseId;
private readonly List<ulong> _mountedAocTitleIds = new();
private readonly List<ulong> _mountedAocTitleIds = [];
public IAddOnContentManager(ServiceCtx context)
{
@@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
private readonly TreeDictionary<ulong, ulong> _tree = new();
private readonly Dictionary<ulong, LinkedListNode<ulong>> _dictionary = new();
private readonly LinkedList<ulong> _list = new();
private readonly LinkedList<ulong> _list = [];
public NvMemoryAllocator()
{
@@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro
return ResultCode.InvalidSize;
}
List<byte[]> hashes = new();
List<byte[]> hashes = [];
for (int i = 0; i < header.HashesCount; i++)
{
@@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService
PlayLogQueryCapability queryCapability = (PlayLogQueryCapability)context.Device.Processes.ActiveApplication.ApplicationControlProperties.PlayLogQueryCapability;
List<ulong> titleIds = new();
List<ulong> titleIds = [];
for (ulong i = 0; i < inputSize / sizeof(ulong); i++)
{
@@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
private BsdContext()
{
_fds = new List<IFileDescriptor>();
_fds = [];
}
public ISocket RetrieveSocket(int socketFd)
@@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public List<IFileDescriptor> RetrieveFileDescriptorsFromMask(ReadOnlySpan<byte> mask)
{
List<IFileDescriptor> fds = new();
List<IFileDescriptor> fds = [];
for (int i = 0; i < mask.Length; i++)
{
@@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{
updatedCount = 0;
List<ManualResetEvent> waiters = new();
List<ManualResetEvent> waiters = [];
for (int i = 0; i < events.Count; i++)
{
@@ -27,9 +27,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Poll(List<PollEvent> events, int timeoutMilliseconds, out int updatedCount)
{
List<ISocketImpl> readEvents = new();
List<ISocketImpl> writeEvents = new();
List<ISocketImpl> errorEvents = new();
List<ISocketImpl> readEvents = [];
List<ISocketImpl> writeEvents = [];
List<ISocketImpl> errorEvents = [];
updatedCount = 0;
@@ -123,9 +123,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Select(List<PollEvent> events, int timeout, out int updatedCount)
{
List<ISocketImpl> readEvents = new();
List<ISocketImpl> writeEvents = new();
List<ISocketImpl> errorEvents = new();
List<ISocketImpl> readEvents = [];
List<ISocketImpl> writeEvents = [];
List<ISocketImpl> errorEvents = [];
updatedCount = 0;
@@ -604,7 +604,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres
private static List<AddrInfoSerialized> DeserializeAddrInfos(IVirtualMemoryManager memory, ulong address, ulong size)
{
List<AddrInfoSerialized> result = new();
List<AddrInfoSerialized> result = [];
ReadOnlySpan<byte> data = memory.GetSpan(address, (int)size);
@@ -66,7 +66,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
ConsumerListener = null;
ConsumerUsageBits = 0;
Queue = new List<BufferItem>();
Queue = [];
// TODO: CreateGraphicBufferAlloc?
@@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
public SystemClockContextUpdateCallback()
{
_operationEventList = new List<KWritableEvent>();
_operationEventList = [];
Context = new SystemClockContext();
_hasContext = false;
}
@@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService
public IApplicationDisplayService(ViServiceType serviceType)
{
_serviceType = serviceType;
_displayInfo = new List<DisplayInfo>();
_displayInfo = [];
_openDisplays = new Dictionary<ulong, DisplayState>();
void AddDisplayInfo(string name, bool layerLimitEnabled, ulong layerLimitMax, ulong width, ulong height)