Remove no-longer-needed warning suppressions

This commit is contained in:
JustArchi 2021-03-22 23:35:44 +01:00
parent f305561f47
commit ae591d3ea8
6 changed files with 7 additions and 17 deletions

View file

@ -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

View file

@ -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<MobileAuthenticator>(json);
// ReSharper disable once ConditionIsAlwaysTrueOrFalse - wrong, "null" json deserializes into null object
if (authenticator == null) {
ArchiLogger.LogNullError(nameof(authenticator));

View file

@ -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));

View file

@ -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));

View file

@ -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));

View file

@ -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));