From c1d9d0407112a2e322dc7f7449439ce9022cf54f Mon Sep 17 00:00:00 2001 From: Archi Date: Fri, 18 Feb 2022 15:40:33 +0100 Subject: [PATCH] Rider cleanup & improvements --- .../SteamTokenDumperPlugin.cs | 2 +- ArchiSteamFarm.sln.DotSettings | 1 + ArchiSteamFarm/Steam/Bot.cs | 8 ++------ ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs | 4 +--- Directory.Packages.props | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs index 009c75a0f..0875fbbc1 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs @@ -475,7 +475,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS return; } - ulong contributorSteamID = ASF.GlobalConfig is { SteamOwnerID: > 0 } && new SteamID(ASF.GlobalConfig.SteamOwnerID).IsIndividualAccount ? ASF.GlobalConfig.SteamOwnerID : Bot.Bots.Values.Where(static bot => bot.SteamID > 0).OrderByDescending(static bot => bot.OwnedPackageIDs.Count).FirstOrDefault()?.SteamID ?? 0; + ulong contributorSteamID = ASF.GlobalConfig is { SteamOwnerID: > 0 } && new SteamID(ASF.GlobalConfig.SteamOwnerID).IsIndividualAccount ? ASF.GlobalConfig.SteamOwnerID : Bot.Bots.Values.Where(static bot => bot.SteamID > 0).MaxBy(static bot => bot.OwnedPackageIDs.Count)?.SteamID ?? 0; if (contributorSteamID == 0) { ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.SubmissionNoContributorSet, nameof(ASF.GlobalConfig.SteamOwnerID))); diff --git a/ArchiSteamFarm.sln.DotSettings b/ArchiSteamFarm.sln.DotSettings index 2bfef41a6..1d183fe98 100644 --- a/ArchiSteamFarm.sln.DotSettings +++ b/ArchiSteamFarm.sln.DotSettings @@ -302,6 +302,7 @@ SUGGESTION SUGGESTION SUGGESTION + SUGGESTION WARNING SUGGESTION WARNING diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 573b76c78..0b3508845 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -1307,9 +1307,7 @@ public sealed class Bot : IAsyncDisposable { OrderedDictionary gamesToRedeemInBackground = new(); using (StreamReader reader = new(filePath)) { - string? line; - - while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null) { + while (await reader.ReadLineAsync().ConfigureAwait(false) is { } line) { if (line.Length == 0) { continue; } @@ -1831,9 +1829,7 @@ public sealed class Bot : IAsyncDisposable { try { using StreamReader reader = new(filePath); - string? line; - - while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null) { + while (await reader.ReadLineAsync().ConfigureAwait(false) is { } line) { if (line.Length == 0) { continue; } diff --git a/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs b/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs index 3a7f09ce0..5506db6dc 100644 --- a/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs +++ b/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs @@ -74,9 +74,7 @@ internal static class SteamChatMessage { using StringReader stringReader = new(message); - string? line; - - while ((line = await stringReader.ReadLineAsync().ConfigureAwait(false)) != null) { + while (await stringReader.ReadLineAsync().ConfigureAwait(false) is { } line) { // Special case for empty newline if (line.Length == 0) { if (messagePart.Length > prefixLength) { diff --git a/Directory.Packages.props b/Directory.Packages.props index 99150651a..3140f51b8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -27,7 +27,7 @@ - +