mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Misc
This commit is contained in:
parent
771d8b3391
commit
01482e8dd0
7 changed files with 10 additions and 22 deletions
|
@ -92,7 +92,7 @@
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceWhileStatementBraces/@EntryIndexedValue">WARNING</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ForeachCanBeConvertedToQueryUsingAnotherGetEnumerator/@EntryIndexedValue">SUGGESTION</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ForeachCanBeConvertedToQueryUsingAnotherGetEnumerator/@EntryIndexedValue">SUGGESTION</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator/@EntryIndexedValue">SUGGESTION</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator/@EntryIndexedValue">SUGGESTION</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FunctionComplexityOverflow/@EntryIndexedValue">SUGGESTION</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FunctionComplexityOverflow/@EntryIndexedValue">HINT</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue">HINT</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue">HINT</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ImplicitlyCapturedClosure/@EntryIndexedValue">SUGGESTION</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ImplicitlyCapturedClosure/@EntryIndexedValue">SUGGESTION</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=IncorrectBlankLinesNearBraces/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=IncorrectBlankLinesNearBraces/@EntryIndexedValue">WARNING</s:String>
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -45,7 +44,7 @@ namespace ArchiSteamFarm {
|
||||||
private bool ProcessingGiftsScheduled;
|
private bool ProcessingGiftsScheduled;
|
||||||
private bool TradingScheduled;
|
private bool TradingScheduled;
|
||||||
|
|
||||||
internal Actions([JetBrains.Annotations.NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
internal Actions([NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
||||||
|
|
||||||
public async ValueTask DisposeAsync() {
|
public async ValueTask DisposeAsync() {
|
||||||
// Those are objects that are always being created if constructor doesn't throw exception
|
// Those are objects that are always being created if constructor doesn't throw exception
|
||||||
|
@ -235,7 +234,6 @@ namespace ArchiSteamFarm {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
public async Task<(bool Success, string Message)> SendInventory(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, Func<Steam.Asset, bool> filterFunction = null) {
|
public async Task<(bool Success, string Message)> SendInventory(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, Func<Steam.Asset, bool> filterFunction = null) {
|
||||||
if ((appID == 0) || (contextID == 0)) {
|
if ((appID == 0) || (contextID == 0)) {
|
||||||
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
|
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
@ -78,7 +77,7 @@ namespace ArchiSteamFarm {
|
||||||
private bool MarkingInventoryScheduled;
|
private bool MarkingInventoryScheduled;
|
||||||
private string VanityURL;
|
private string VanityURL;
|
||||||
|
|
||||||
internal ArchiWebHandler([JetBrains.Annotations.NotNull] Bot bot) {
|
internal ArchiWebHandler([NotNull] Bot bot) {
|
||||||
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
||||||
|
|
||||||
CachedApiKey = new ArchiCacheable<string>(ResolveApiKey);
|
CachedApiKey = new ArchiCacheable<string>(ResolveApiKey);
|
||||||
|
@ -111,9 +110,8 @@ namespace ArchiSteamFarm {
|
||||||
return string.IsNullOrEmpty(VanityURL) ? "/profiles/" + Bot.SteamID : "/id/" + VanityURL;
|
return string.IsNullOrEmpty(VanityURL) ? "/profiles/" + Bot.SteamID : "/id/" + VanityURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JetBrains.Annotations.NotNull]
|
[NotNull]
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
public async IAsyncEnumerable<Steam.Asset> GetInventoryAsync(ulong steamID = 0, uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID) {
|
public async IAsyncEnumerable<Steam.Asset> GetInventoryAsync(ulong steamID = 0, uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID) {
|
||||||
if ((appID == 0) || (contextID == 0)) {
|
if ((appID == 0) || (contextID == 0)) {
|
||||||
throw new ArgumentException(string.Format(Strings.ErrorObjectIsNull, nameof(appID) + " || " + nameof(contextID)));
|
throw new ArgumentException(string.Format(Strings.ErrorObjectIsNull, nameof(appID) + " || " + nameof(contextID)));
|
||||||
|
@ -1381,7 +1379,7 @@ namespace ArchiSteamFarm {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JetBrains.Annotations.NotNull]
|
[NotNull]
|
||||||
internal HttpClient GenerateDisposableHttpClient() => WebBrowser.GenerateDisposableHttpClient();
|
internal HttpClient GenerateDisposableHttpClient() => WebBrowser.GenerateDisposableHttpClient();
|
||||||
|
|
||||||
[ItemCanBeNull]
|
[ItemCanBeNull]
|
||||||
|
|
|
@ -24,7 +24,6 @@ using System.Collections;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
@ -149,7 +148,7 @@ namespace ArchiSteamFarm {
|
||||||
|
|
||||||
#pragma warning disable IDE0051
|
#pragma warning disable IDE0051
|
||||||
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamID))]
|
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamID))]
|
||||||
[JetBrains.Annotations.NotNull]
|
[NotNull]
|
||||||
private string SSteamID => SteamID.ToString();
|
private string SSteamID => SteamID.ToString();
|
||||||
#pragma warning restore IDE0051
|
#pragma warning restore IDE0051
|
||||||
|
|
||||||
|
@ -201,7 +200,7 @@ namespace ArchiSteamFarm {
|
||||||
private string TwoFactorCode;
|
private string TwoFactorCode;
|
||||||
private byte TwoFactorCodeFailures;
|
private byte TwoFactorCodeFailures;
|
||||||
|
|
||||||
private Bot([JetBrains.Annotations.NotNull] string botName, [JetBrains.Annotations.NotNull] BotConfig botConfig, [JetBrains.Annotations.NotNull] BotDatabase botDatabase) {
|
private Bot([NotNull] string botName, [NotNull] BotConfig botConfig, [NotNull] BotDatabase botDatabase) {
|
||||||
if (string.IsNullOrEmpty(botName) || (botConfig == null) || (botDatabase == null)) {
|
if (string.IsNullOrEmpty(botName) || (botConfig == null) || (botDatabase == null)) {
|
||||||
throw new ArgumentNullException(nameof(botName) + " || " + nameof(botConfig) + " || " + nameof(botDatabase));
|
throw new ArgumentNullException(nameof(botName) + " || " + nameof(botConfig) + " || " + nameof(botDatabase));
|
||||||
}
|
}
|
||||||
|
@ -2830,7 +2829,6 @@ namespace ArchiSteamFarm {
|
||||||
WalletCurrency = callback.Currency;
|
WalletCurrency = callback.Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
private async Task RedeemGamesInBackground() {
|
private async Task RedeemGamesInBackground() {
|
||||||
if (!await GamesRedeemerInBackgroundSemaphore.WaitAsync(0).ConfigureAwait(false)) {
|
if (!await GamesRedeemerInBackgroundSemaphore.WaitAsync(0).ConfigureAwait(false)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -23,7 +23,6 @@ using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -98,7 +97,7 @@ namespace ArchiSteamFarm {
|
||||||
private bool PermanentlyPaused;
|
private bool PermanentlyPaused;
|
||||||
private bool ShouldResumeFarming = true;
|
private bool ShouldResumeFarming = true;
|
||||||
|
|
||||||
internal CardsFarmer([JetBrains.Annotations.NotNull] Bot bot) {
|
internal CardsFarmer([NotNull] Bot bot) {
|
||||||
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
||||||
|
|
||||||
if (ASF.GlobalConfig.IdleFarmingPeriod > 0) {
|
if (ASF.GlobalConfig.IdleFarmingPeriod > 0) {
|
||||||
|
@ -373,7 +372,6 @@ namespace ArchiSteamFarm {
|
||||||
await StartFarming().ConfigureAwait(false);
|
await StartFarming().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
private async Task CheckPage(IDocument htmlDocument, ISet<uint> parsedAppIDs) {
|
private async Task CheckPage(IDocument htmlDocument, ISet<uint> parsedAppIDs) {
|
||||||
if ((htmlDocument == null) || (parsedAppIDs == null)) {
|
if ((htmlDocument == null) || (parsedAppIDs == null)) {
|
||||||
Bot.ArchiLogger.LogNullError(nameof(htmlDocument) + " || " + nameof(parsedAppIDs));
|
Bot.ArchiLogger.LogNullError(nameof(htmlDocument) + " || " + nameof(parsedAppIDs));
|
||||||
|
@ -1243,7 +1241,7 @@ namespace ArchiSteamFarm {
|
||||||
|
|
||||||
internal uint PlayableAppID { get; set; }
|
internal uint PlayableAppID { get; set; }
|
||||||
|
|
||||||
internal Game(uint appID, [JetBrains.Annotations.NotNull] string gameName, float hoursPlayed, ushort cardsRemaining, byte badgeLevel) {
|
internal Game(uint appID, [NotNull] string gameName, float hoursPlayed, ushort cardsRemaining, byte badgeLevel) {
|
||||||
if ((appID == 0) || string.IsNullOrEmpty(gameName) || (hoursPlayed < 0) || (cardsRemaining == 0)) {
|
if ((appID == 0) || string.IsNullOrEmpty(gameName) || (hoursPlayed < 0) || (cardsRemaining == 0)) {
|
||||||
throw new ArgumentOutOfRangeException(nameof(appID) + " || " + nameof(gameName) + " || " + nameof(hoursPlayed) + " || " + nameof(cardsRemaining));
|
throw new ArgumentOutOfRangeException(nameof(appID) + " || " + nameof(gameName) + " || " + nameof(hoursPlayed) + " || " + nameof(cardsRemaining));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -40,7 +39,7 @@ namespace ArchiSteamFarm {
|
||||||
private readonly Bot Bot;
|
private readonly Bot Bot;
|
||||||
private readonly Dictionary<uint, string> CachedGamesOwned = new Dictionary<uint, string>();
|
private readonly Dictionary<uint, string> CachedGamesOwned = new Dictionary<uint, string>();
|
||||||
|
|
||||||
internal Commands([JetBrains.Annotations.NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
internal Commands([NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string FormatBotResponse(string response, string botName) {
|
public static string FormatBotResponse(string response, string botName) {
|
||||||
|
@ -1635,7 +1634,6 @@ namespace ArchiSteamFarm {
|
||||||
return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
|
return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
private async Task<(string Response, Dictionary<string, string> OwnedGames)> ResponseOwns(ulong steamID, string query) {
|
private async Task<(string Response, Dictionary<string, string> OwnedGames)> ResponseOwns(ulong steamID, string query) {
|
||||||
if ((steamID == 0) || string.IsNullOrEmpty(query)) {
|
if ((steamID == 0) || string.IsNullOrEmpty(query)) {
|
||||||
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(query));
|
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(query));
|
||||||
|
@ -2154,7 +2152,6 @@ namespace ArchiSteamFarm {
|
||||||
return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
|
return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
private async Task<string> ResponseRedeem(ulong steamID, string keysText, ERedeemFlags redeemFlags = ERedeemFlags.None) {
|
private async Task<string> ResponseRedeem(ulong steamID, string keysText, ERedeemFlags redeemFlags = ERedeemFlags.None) {
|
||||||
if ((steamID == 0) || string.IsNullOrEmpty(keysText)) {
|
if ((steamID == 0) || string.IsNullOrEmpty(keysText)) {
|
||||||
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(keysText));
|
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(keysText));
|
||||||
|
|
|
@ -352,7 +352,6 @@ namespace ArchiSteamFarm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
|
|
||||||
private async Task<bool> MatchActivelyRound(IReadOnlyCollection<Steam.Asset.EType> acceptedMatchableTypes, IDictionary<ulong, (byte Tries, ISet<ulong> GivenAssetIDs, ISet<ulong> ReceivedAssetIDs)> triedSteamIDs) {
|
private async Task<bool> MatchActivelyRound(IReadOnlyCollection<Steam.Asset.EType> acceptedMatchableTypes, IDictionary<ulong, (byte Tries, ISet<ulong> GivenAssetIDs, ISet<ulong> ReceivedAssetIDs)> triedSteamIDs) {
|
||||||
if ((acceptedMatchableTypes == null) || (acceptedMatchableTypes.Count == 0) || (triedSteamIDs == null)) {
|
if ((acceptedMatchableTypes == null) || (acceptedMatchableTypes.Count == 0) || (triedSteamIDs == null)) {
|
||||||
Bot.ArchiLogger.LogNullError(nameof(acceptedMatchableTypes) + " || " + nameof(triedSteamIDs));
|
Bot.ArchiLogger.LogNullError(nameof(acceptedMatchableTypes) + " || " + nameof(triedSteamIDs));
|
||||||
|
|
Loading…
Reference in a new issue