diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs index caca03ccd..aec184fd4 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs @@ -37,7 +37,6 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin { // Your plugin class should inherit the plugin interfaces it wants to handle // If you do not want to handle a particular action (e.g. OnBotMessage that is offered in IBotMessage), it's the best idea to not inherit it at all // This will keep your code compact, efficient and less dependent. You can always add additional interfaces when you'll need them, this example project will inherit quite a bit of them to show you potential usage - // ReSharper disable once UnusedType.Global - this is example plugin class that isn't used in our main code internal sealed class ExamplePlugin : IASF, IBot, IBotCommand, IBotConnection, IBotFriendRequest, IBotMessage, IBotModules, IBotTradeOffer { // This is used for identification purposes, typically you want to use a friendly name of your plugin here, such as the name of your main class // Please note that this property can have direct dependencies only on structures that were initialized by the constructor, as it's possible to be called before OnLoaded() takes place diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 2c4332b4d..d360ec999 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -514,7 +514,7 @@ namespace ArchiSteamFarm { throw new ArgumentNullException(nameof(inventory)); } - if ((amountsToExtract == null) || (amountsToExtract.Count == 0) || amountsToExtract.Values.Any(kv => kv.SetsToExtract == 0)) { + if ((amountsToExtract == null) || (amountsToExtract.Count == 0)) { throw new ArgumentNullException(nameof(amountsToExtract)); } @@ -762,12 +762,11 @@ namespace ArchiSteamFarm { int partLength; bool copyNewline = false; - // ReSharper disable ArrangeMissingParentheses - conflict with Roslyn if (message.Length - i > maxMessageLength) { - int lastNewLine = message.LastIndexOf(Environment.NewLine, i + maxMessageLength - Environment.NewLine.Length, maxMessageLength - Environment.NewLine.Length, StringComparison.Ordinal); + int lastNewLine = message.LastIndexOf(Environment.NewLine, (i + maxMessageLength) - Environment.NewLine.Length, maxMessageLength - Environment.NewLine.Length, StringComparison.Ordinal); if (lastNewLine > i) { - partLength = lastNewLine - i + Environment.NewLine.Length; + partLength = (lastNewLine - i) + Environment.NewLine.Length; copyNewline = true; } else { partLength = maxMessageLength; @@ -777,12 +776,11 @@ namespace ArchiSteamFarm { } // If our message is of max length and ends with a single '\' then we can't split it here, it escapes the next character - if ((partLength >= maxMessageLength) && (message[i + partLength - 1] == '\\') && (message[i + partLength - 2] != '\\')) { + if ((partLength >= maxMessageLength) && (message[(i + partLength) - 1] == '\\') && (message[(i + partLength) - 2] != '\\')) { // Instead, we'll cut this message one char short and include the rest in next iteration partLength--; } - // ReSharper restore ArrangeMissingParentheses string messagePart = message.Substring(i, partLength); messagePart = steamMessagePrefix + (i > 0 ? "…" : "") + messagePart + (maxMessageLength < message.Length - i ? "…" : ""); @@ -862,16 +860,15 @@ namespace ArchiSteamFarm { int i = 0; - // ReSharper disable ArrangeMissingParentheses - conflict with Roslyn while (i < message.Length) { int partLength; bool copyNewline = false; if (message.Length - i > maxMessageLength) { - int lastNewLine = message.LastIndexOf(Environment.NewLine, i + maxMessageLength - Environment.NewLine.Length, maxMessageLength - Environment.NewLine.Length, StringComparison.Ordinal); + int lastNewLine = message.LastIndexOf(Environment.NewLine, (i + maxMessageLength) - Environment.NewLine.Length, maxMessageLength - Environment.NewLine.Length, StringComparison.Ordinal); if (lastNewLine > i) { - partLength = lastNewLine - i + Environment.NewLine.Length; + partLength = (lastNewLine - i) + Environment.NewLine.Length; copyNewline = true; } else { partLength = maxMessageLength; @@ -881,12 +878,11 @@ namespace ArchiSteamFarm { } // If our message is of max length and ends with a single '\' then we can't split it here, it escapes the next character - if ((partLength >= maxMessageLength) && (message[i + partLength - 1] == '\\') && (message[i + partLength - 2] != '\\')) { + if ((partLength >= maxMessageLength) && (message[(i + partLength) - 1] == '\\') && (message[(i + partLength) - 2] != '\\')) { // Instead, we'll cut this message one char short and include the rest in next iteration partLength--; } - // ReSharper restore ArrangeMissingParentheses string messagePart = message.Substring(i, partLength); messagePart = steamMessagePrefix + (i > 0 ? "…" : "") + messagePart + (maxMessageLength < message.Length - i ? "…" : ""); @@ -1978,7 +1974,6 @@ namespace ArchiSteamFarm { MobileAuthenticator? authenticator = JsonConvert.DeserializeObject(json); - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - wrong, "null" json deserializes into null object if (authenticator == null) { ArchiLogger.LogNullError(nameof(authenticator)); diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index a25562fb7..4e6673efc 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -437,7 +437,6 @@ namespace ArchiSteamFarm { return null; } - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - wrong, "null" json deserializes into null object if (botConfig == null) { ASF.ArchiLogger.LogNullError(nameof(botConfig)); diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index e91157276..6623f981d 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -163,7 +163,6 @@ namespace ArchiSteamFarm { return null; } - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - wrong, "null" json deserializes into null object if (botDatabase == null) { ASF.ArchiLogger.LogNullError(nameof(botDatabase)); diff --git a/ArchiSteamFarm/GlobalConfig.cs b/ArchiSteamFarm/GlobalConfig.cs index 3791b6499..af200c969 100644 --- a/ArchiSteamFarm/GlobalConfig.cs +++ b/ArchiSteamFarm/GlobalConfig.cs @@ -363,7 +363,6 @@ namespace ArchiSteamFarm { return null; } - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - wrong, "null" json deserializes into null object if (globalConfig == null) { ASF.ArchiLogger.LogNullError(nameof(globalConfig)); diff --git a/ArchiSteamFarm/GlobalDatabase.cs b/ArchiSteamFarm/GlobalDatabase.cs index eb270499e..5b7bf8654 100644 --- a/ArchiSteamFarm/GlobalDatabase.cs +++ b/ArchiSteamFarm/GlobalDatabase.cs @@ -144,7 +144,6 @@ namespace ArchiSteamFarm { return null; } - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - wrong, "null" json deserializes into null object if (globalDatabase == null) { ASF.ArchiLogger.LogNullError(nameof(globalDatabase));