diff --git a/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs b/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs index 9b95b8548..eeaa8e64c 100644 --- a/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.Monitoring/MonitoringPlugin.cs @@ -147,7 +147,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG Meter.CreateObservableGauge( $"{MetricNamePrefix}_bots", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; int onlineCount = 0; int offlineCount = 0; @@ -177,7 +177,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG Meter.CreateObservableGauge( $"{MetricNamePrefix}_bot_friends", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; return bots.Where(static bot => bot.IsConnectedAndLoggedOn).Select(static bot => new Measurement(bot.SteamFriends.GetFriendCount(), new KeyValuePair(TagNames.BotName, bot.BotName), new KeyValuePair(TagNames.SteamID, bot.SteamID))); }, @@ -186,7 +186,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG Meter.CreateObservableGauge( $"{MetricNamePrefix}_bot_clans", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; return bots.Where(static bot => bot.IsConnectedAndLoggedOn).Select(static bot => new Measurement(bot.SteamFriends.GetClanCount(), new KeyValuePair(TagNames.BotName, bot.BotName), new KeyValuePair(TagNames.SteamID, bot.SteamID))); }, @@ -196,7 +196,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG // Keep in mind that we use a unit here and the unit needs to be a suffix to the name Meter.CreateObservableGauge( $"{MetricNamePrefix}_bot_farming_time_remaining_{Units.Minutes}", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; return bots.Select(static bot => new Measurement(bot.CardsFarmer.TimeRemaining.TotalMinutes, new KeyValuePair(TagNames.BotName, bot.BotName), new KeyValuePair(TagNames.SteamID, bot.SteamID))); }, @@ -206,7 +206,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG Meter.CreateObservableGauge( $"{MetricNamePrefix}_bot_heartbeat_failures", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; return bots.Select(static bot => new Measurement(bot.HeartBeatFailures, new KeyValuePair(TagNames.BotName, bot.BotName), new KeyValuePair(TagNames.SteamID, bot.SteamID))); }, @@ -215,7 +215,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG Meter.CreateObservableGauge( $"{MetricNamePrefix}_bot_wallet_balance", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; return bots.Where(static bot => bot.WalletCurrency != ECurrencyCode.Invalid).Select(static bot => new Measurement(bot.WalletBalance, new KeyValuePair(TagNames.BotName, bot.BotName), new KeyValuePair(TagNames.SteamID, bot.SteamID), new KeyValuePair(TagNames.CurrencyCode, bot.WalletCurrency.ToString()))); }, @@ -224,7 +224,7 @@ internal sealed class MonitoringPlugin : OfficialPlugin, IWebServiceProvider, IG Meter.CreateObservableGauge( $"{MetricNamePrefix}_bot_bgr_keys_remaining", static () => { - IEnumerable bots = Bot.Bots?.Values ?? Enumerable.Empty(); + IEnumerable bots = Bot.Bots?.Values ?? []; return bots.Select(static bot => new Measurement((int) bot.GamesToRedeemInBackgroundCount, new KeyValuePair(TagNames.BotName, bot.BotName), new KeyValuePair(TagNames.SteamID, bot.SteamID))); }, diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs index 75de277fb..e4c105adc 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs @@ -385,7 +385,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC SteamApps.PICSTokensCallback response; try { - response = await bot.SteamApps.PICSGetAccessTokens(appIDsThisRound, Enumerable.Empty()).ToLongRunningTask().ConfigureAwait(false); + response = await bot.SteamApps.PICSGetAccessTokens(appIDsThisRound, []).ToLongRunningTask().ConfigureAwait(false); } catch (Exception e) { bot.ArchiLogger.LogGenericWarningException(e); @@ -426,7 +426,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC AsyncJobMultiple.ResultSet response; try { - response = await bot.SteamApps.PICSGetProductInfo(appIDsThisRound.Select(static appID => new SteamApps.PICSRequest(appID, GlobalCache.GetAppToken(appID))), Enumerable.Empty()).ToLongRunningTask().ConfigureAwait(false); + response = await bot.SteamApps.PICSGetProductInfo(appIDsThisRound.Select(static appID => new SteamApps.PICSRequest(appID, GlobalCache.GetAppToken(appID))), []).ToLongRunningTask().ConfigureAwait(false); } catch (Exception e) { bot.ArchiLogger.LogGenericWarningException(e); diff --git a/ArchiSteamFarm/IPC/ArchiKestrel.cs b/ArchiSteamFarm/IPC/ArchiKestrel.cs index 18813417d..198492543 100644 --- a/ArchiSteamFarm/IPC/ArchiKestrel.cs +++ b/ArchiSteamFarm/IPC/ArchiKestrel.cs @@ -336,7 +336,7 @@ internal static class ArchiKestrel { } }, - Array.Empty() + [] } } ); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs index d5ebce27d..ffb5b498c 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs @@ -122,7 +122,7 @@ public sealed class NLogController : ArchiController { } while (webSocket.State == WebSocketState.Open) { - WebSocketReceiveResult result = await webSocket.ReceiveAsync(Array.Empty(), cancellationToken).ConfigureAwait(false); + WebSocketReceiveResult result = await webSocket.ReceiveAsync([], cancellationToken).ConfigureAwait(false); if (result.MessageType != WebSocketMessageType.Close) { await webSocket.CloseAsync(WebSocketCloseStatus.InvalidMessageType, "You're not supposed to be sending any message but Close!", cancellationToken).ConfigureAwait(false); diff --git a/ArchiSteamFarm/Plugins/PluginsCore.cs b/ArchiSteamFarm/Plugins/PluginsCore.cs index bf9845368..dbc581a8a 100644 --- a/ArchiSteamFarm/Plugins/PluginsCore.cs +++ b/ArchiSteamFarm/Plugins/PluginsCore.cs @@ -579,7 +579,7 @@ public static class PluginsCore { return null; } - return responses.Where(static response => response != null).SelectMany(static handlers => handlers ?? Enumerable.Empty()).ToHashSet(); + return responses.Where(static response => response != null).SelectMany(static handlers => handlers ?? []).ToHashSet(); } internal static async Task OnBotTradeOffer(Bot bot, TradeOffer tradeOffer) { diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index e8ea8bd81..fa128f43a 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -1200,7 +1200,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable { for (byte i = 0; (i < WebBrowser.MaxTries) && (productInfoResultSet == null) && IsConnectedAndLoggedOn; i++) { try { - productInfoResultSet = await SteamApps.PICSGetProductInfo(request.ToEnumerable(), Enumerable.Empty()).ToLongRunningTask().ConfigureAwait(false); + productInfoResultSet = await SteamApps.PICSGetProductInfo(request.ToEnumerable(), []).ToLongRunningTask().ConfigureAwait(false); } catch (Exception e) { ArchiLogger.LogGenericWarningException(e); } @@ -1338,7 +1338,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable { for (byte i = 0; (i < WebBrowser.MaxTries) && (productInfoResultSet == null) && IsConnectedAndLoggedOn; i++) { try { - productInfoResultSet = await SteamApps.PICSGetProductInfo(Enumerable.Empty(), packageRequests).ToLongRunningTask().ConfigureAwait(false); + productInfoResultSet = await SteamApps.PICSGetProductInfo([], packageRequests).ToLongRunningTask().ConfigureAwait(false); } catch (Exception e) { ArchiLogger.LogGenericWarningException(e); } diff --git a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs index 95c46a089..ec0f1de0a 100644 --- a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs +++ b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs @@ -507,7 +507,7 @@ public sealed class ArchiWebHandler : IDisposable { return null; } - IEnumerable trades = Enumerable.Empty(); + IEnumerable trades = []; if (receivedOffers.GetValueOrDefault(true)) { trades = trades.Concat(response.TradeOffersReceived); diff --git a/ArchiSteamFarm/Steam/Interaction/Actions.cs b/ArchiSteamFarm/Steam/Interaction/Actions.cs index 37dfbbb8e..df34923da 100644 --- a/ArchiSteamFarm/Steam/Interaction/Actions.cs +++ b/ArchiSteamFarm/Steam/Interaction/Actions.cs @@ -269,7 +269,7 @@ public sealed class Actions : IAsyncDisposable, IDisposable { // We add extra delay because OnFarmingStopped() also executes PlayGames() // Despite of proper order on our end, Steam network might not respect it await Task.Delay(Bot.CallbackSleep).ConfigureAwait(false); - await Bot.ArchiHandler.PlayGames(Array.Empty(), Bot.BotConfig.CustomGamePlayedWhileIdle).ConfigureAwait(false); + await Bot.ArchiHandler.PlayGames([], Bot.BotConfig.CustomGamePlayedWhileIdle).ConfigureAwait(false); } if (resumeInSeconds > 0) { diff --git a/ArchiSteamFarm/Steam/Interaction/Commands.cs b/ArchiSteamFarm/Steam/Interaction/Commands.cs index 4eb5855de..20d32256a 100644 --- a/ArchiSteamFarm/Steam/Interaction/Commands.cs +++ b/ArchiSteamFarm/Steam/Interaction/Commands.cs @@ -647,8 +647,8 @@ public sealed class Commands { break; } - grantedApps ??= Array.Empty(); - grantedPackages ??= Array.Empty(); + grantedApps ??= []; + grantedPackages ??= []; response.AppendLine(FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotAddLicenseWithItems, $"app/{gameID}", result, string.Join(", ", grantedApps.Select(static appID => $"app/{appID}").Union(grantedPackages.Select(static subID => $"sub/{subID}"))))));