diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs index af2d57ff0..537ed5285 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/RemoteCommunication.cs @@ -1164,7 +1164,7 @@ internal sealed class RemoteCommunication : IAsyncDisposable, IDisposable { } } - private async Task MatchActively(IReadOnlyCollection listedUsers, IReadOnlyCollection ourAssets, IReadOnlyCollection acceptedMatchableTypes) { + private async Task MatchActively(ImmutableHashSet listedUsers, HashSet ourAssets, HashSet acceptedMatchableTypes) { if ((listedUsers == null) || (listedUsers.Count == 0)) { throw new ArgumentNullException(nameof(listedUsers)); } diff --git a/ArchiSteamFarm.Tests/AssemblyInfo.cs b/ArchiSteamFarm.Tests/AssemblyInfo.cs index f432632cb..3075a7cd8 100644 --- a/ArchiSteamFarm.Tests/AssemblyInfo.cs +++ b/ArchiSteamFarm.Tests/AssemblyInfo.cs @@ -25,4 +25,5 @@ using System; using Microsoft.VisualStudio.TestTools.UnitTesting; [assembly: CLSCompliant(false)] +[assembly: DiscoverInternals] [assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] diff --git a/ArchiSteamFarm.Tests/Bot.cs b/ArchiSteamFarm.Tests/Bot.cs index 640c24bca..8c3d0ccc6 100644 --- a/ArchiSteamFarm.Tests/Bot.cs +++ b/ArchiSteamFarm.Tests/Bot.cs @@ -23,6 +23,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using ArchiSteamFarm.Steam.Data; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -30,10 +31,11 @@ using static ArchiSteamFarm.Steam.Bot; namespace ArchiSteamFarm.Tests; +#pragma warning disable CA1812 // False positive, the class is used during MSTest [TestClass] -public sealed class Bot { +internal sealed class Bot { [TestMethod] - public void MaxItemsBarelyEnoughForOneSet() { + internal void MaxItemsBarelyEnoughForOneSet() { const uint relevantAppID = 42; Dictionary itemsPerSet = new() { @@ -57,7 +59,7 @@ public sealed class Bot { } [TestMethod] - public void MaxItemsTooSmall() { + internal void MaxItemsTooSmall() { const uint appID = 42; HashSet items = [ @@ -69,7 +71,7 @@ public sealed class Bot { } [TestMethod] - public void MoreCardsThanNeeded() { + internal void MoreCardsThanNeeded() { const uint appID = 42; HashSet items = [ @@ -91,7 +93,7 @@ public sealed class Bot { } [TestMethod] - public void MultipleSets() { + internal void MultipleSets() { const uint appID = 42; HashSet items = [ @@ -112,7 +114,7 @@ public sealed class Bot { } [TestMethod] - public void MultipleSetsDifferentAmount() { + internal void MultipleSetsDifferentAmount() { const uint appID = 42; HashSet items = [ @@ -132,7 +134,7 @@ public sealed class Bot { } [TestMethod] - public void MutliRarityAndType() { + internal void MutliRarityAndType() { const uint appID = 42; HashSet items = [ @@ -173,7 +175,7 @@ public sealed class Bot { } [TestMethod] - public void NotAllCardsPresent() { + internal void NotAllCardsPresent() { const uint appID = 42; HashSet items = [ @@ -188,7 +190,7 @@ public sealed class Bot { } [TestMethod] - public void OneSet() { + internal void OneSet() { const uint appID = 42; HashSet items = [ @@ -207,7 +209,7 @@ public sealed class Bot { } [TestMethod] - public void OtherAppIDFullSets() { + internal void OtherAppIDFullSets() { const uint appID0 = 42; const uint appID1 = 43; @@ -232,7 +234,7 @@ public sealed class Bot { } [TestMethod] - public void OtherAppIDNoSets() { + internal void OtherAppIDNoSets() { const uint appID0 = 42; const uint appID1 = 43; @@ -254,7 +256,7 @@ public sealed class Bot { } [TestMethod] - public void OtherAppIDOneSet() { + internal void OtherAppIDOneSet() { const uint appID0 = 42; const uint appID1 = 43; const uint appID2 = 44; @@ -286,7 +288,7 @@ public sealed class Bot { } [TestMethod] - public void OtherRarityFullSets() { + internal void OtherRarityFullSets() { const uint appID = 42; HashSet items = [ @@ -304,7 +306,7 @@ public sealed class Bot { } [TestMethod] - public void OtherRarityNoSets() { + internal void OtherRarityNoSets() { const uint appID = 42; HashSet items = [ @@ -320,7 +322,7 @@ public sealed class Bot { } [TestMethod] - public void OtherRarityOneSet() { + internal void OtherRarityOneSet() { const uint appID = 42; HashSet items = [ @@ -343,7 +345,7 @@ public sealed class Bot { } [TestMethod] - public void OtherTypeFullSets() { + internal void OtherTypeFullSets() { const uint appID = 42; HashSet items = [ @@ -361,7 +363,7 @@ public sealed class Bot { } [TestMethod] - public void OtherTypeNoSets() { + internal void OtherTypeNoSets() { const uint appID = 42; HashSet items = [ @@ -377,7 +379,7 @@ public sealed class Bot { } [TestMethod] - public void OtherTypeOneSet() { + internal void OtherTypeOneSet() { const uint appID = 42; HashSet items = [ @@ -400,7 +402,7 @@ public sealed class Bot { } [TestMethod] - public void TooHighAmount() { + internal void TooHighAmount() { const uint appID0 = 42; HashSet items = [ @@ -419,7 +421,7 @@ public sealed class Bot { } [TestMethod] - public void TooManyCardsForSingleTrade() { + internal void TooManyCardsForSingleTrade() { const uint appID = 42; HashSet items = []; @@ -435,7 +437,7 @@ public sealed class Bot { } [TestMethod] - public void TooManyCardsForSingleTradeMultipleAppIDs() { + internal void TooManyCardsForSingleTradeMultipleAppIDs() { const uint appID0 = 42; const uint appID1 = 43; @@ -459,7 +461,7 @@ public sealed class Bot { } [TestMethod] - public void TooManyCardsPerSet() { + internal void TooManyCardsPerSet() { const uint appID0 = 42; const uint appID1 = 43; const uint appID2 = 44; @@ -482,7 +484,7 @@ public sealed class Bot { ); } - private static void AssertResultMatchesExpectation(IReadOnlyDictionary<(uint RealAppID, ulong ContextID, ulong ClassID), uint> expectedResult, IReadOnlyCollection itemsToSend) { + private static void AssertResultMatchesExpectation(Dictionary<(uint RealAppID, ulong ContextID, ulong ClassID), uint> expectedResult, IReadOnlyCollection itemsToSend) { ArgumentNullException.ThrowIfNull(expectedResult); ArgumentNullException.ThrowIfNull(itemsToSend); @@ -495,9 +497,10 @@ public sealed class Bot { private static HashSet GetItemsForFullBadge(IReadOnlyCollection inventory, byte cardsPerSet, uint appID, ushort maxItems = Steam.Exchange.Trading.MaxItemsPerTrade) => GetItemsForFullBadge(inventory, new Dictionary { { appID, cardsPerSet } }, maxItems); - private static HashSet GetItemsForFullBadge(IReadOnlyCollection inventory, IDictionary cardsPerSet, ushort maxItems = Steam.Exchange.Trading.MaxItemsPerTrade) { + private static HashSet GetItemsForFullBadge(IReadOnlyCollection inventory, [SuppressMessage("ReSharper", "SuggestBaseTypeForParameter")] Dictionary cardsPerSet, ushort maxItems = Steam.Exchange.Trading.MaxItemsPerTrade) { Dictionary<(uint RealAppID, EAssetType Type, EAssetRarity Rarity), List> inventorySets = Steam.Exchange.Trading.GetInventorySets(inventory); return GetItemsForFullSets(inventory, inventorySets.ToDictionary(static kv => kv.Key, kv => (SetsToExtract: inventorySets[kv.Key][0], cardsPerSet[kv.Key.RealAppID])), maxItems).ToHashSet(); } } +#pragma warning restore CA1812 // False positive, the class is used during MSTest diff --git a/ArchiSteamFarm.Tests/SteamChatMessage.cs b/ArchiSteamFarm.Tests/SteamChatMessage.cs index 1fe082a8f..307a0b789 100644 --- a/ArchiSteamFarm.Tests/SteamChatMessage.cs +++ b/ArchiSteamFarm.Tests/SteamChatMessage.cs @@ -31,10 +31,11 @@ using static ArchiSteamFarm.Steam.Integration.SteamChatMessage; namespace ArchiSteamFarm.Tests; +#pragma warning disable CA1812 // False positive, the class is used during MSTest [TestClass] -public sealed class SteamChatMessage { +internal sealed class SteamChatMessage { [TestMethod] - public async Task CanSplitEvenWithStupidlyLongPrefix() { + internal async Task CanSplitEvenWithStupidlyLongPrefix() { string prefix = new('x', MaxMessagePrefixBytes); const string emoji = "😎"; @@ -51,10 +52,10 @@ public sealed class SteamChatMessage { } [TestMethod] - public void ContinuationCharacterSizeIsProperlyCalculated() => Assert.AreEqual(ContinuationCharacterBytes, Encoding.UTF8.GetByteCount(ContinuationCharacter.ToString())); + internal void ContinuationCharacterSizeIsProperlyCalculated() => Assert.AreEqual(ContinuationCharacterBytes, Encoding.UTF8.GetByteCount(ContinuationCharacter.ToString())); [TestMethod] - public async Task DoesntSkipEmptyNewlines() { + internal async Task DoesntSkipEmptyNewlines() { string message = $"asdf{Environment.NewLine}{Environment.NewLine}asdf"; List output = await GetMessageParts(message).ToListAsync().ConfigureAwait(false); @@ -66,7 +67,7 @@ public sealed class SteamChatMessage { [DataRow(false)] [DataRow(true)] [DataTestMethod] - public async Task DoesntSplitInTheMiddleOfMultiByteChar(bool isAccountLimited) { + internal async Task DoesntSplitInTheMiddleOfMultiByteChar(bool isAccountLimited) { int maxMessageBytes = isAccountLimited ? MaxMessageBytesForLimitedAccounts : MaxMessageBytesForUnlimitedAccounts; int longLineLength = maxMessageBytes - ReservedContinuationMessageBytes; @@ -84,7 +85,7 @@ public sealed class SteamChatMessage { } [TestMethod] - public async Task DoesntSplitJustBecauseOfLastEscapableCharacter() { + internal async Task DoesntSplitJustBecauseOfLastEscapableCharacter() { const string message = "abcdef["; const string escapedMessage = @"abcdef\["; @@ -97,7 +98,7 @@ public sealed class SteamChatMessage { [DataRow(false)] [DataRow(true)] [DataTestMethod] - public async Task DoesntSplitOnBackslashNotUsedForEscaping(bool isAccountLimited) { + internal async Task DoesntSplitOnBackslashNotUsedForEscaping(bool isAccountLimited) { int maxMessageBytes = isAccountLimited ? MaxMessageBytesForLimitedAccounts : MaxMessageBytesForUnlimitedAccounts; int longLineLength = maxMessageBytes - ReservedContinuationMessageBytes; @@ -113,7 +114,7 @@ public sealed class SteamChatMessage { [DataRow(false)] [DataRow(true)] [DataTestMethod] - public async Task DoesntSplitOnEscapeCharacter(bool isAccountLimited) { + internal async Task DoesntSplitOnEscapeCharacter(bool isAccountLimited) { int maxMessageBytes = isAccountLimited ? MaxMessageBytesForLimitedAccounts : MaxMessageBytesForUnlimitedAccounts; int longLineLength = maxMessageBytes - ReservedContinuationMessageBytes; @@ -129,7 +130,7 @@ public sealed class SteamChatMessage { } [TestMethod] - public async Task NoNeedForAnySplittingWithNewlines() { + internal async Task NoNeedForAnySplittingWithNewlines() { string message = $"abcdef{Environment.NewLine}ghijkl{Environment.NewLine}mnopqr"; List output = await GetMessageParts(message).ToListAsync().ConfigureAwait(false); @@ -139,7 +140,7 @@ public sealed class SteamChatMessage { } [TestMethod] - public async Task NoNeedForAnySplittingWithoutNewlines() { + internal async Task NoNeedForAnySplittingWithoutNewlines() { const string message = "abcdef"; List output = await GetMessageParts(message).ToListAsync().ConfigureAwait(false); @@ -149,10 +150,10 @@ public sealed class SteamChatMessage { } [TestMethod] - public void ParagraphCharacterSizeIsLessOrEqualToContinuationCharacterSize() => Assert.IsTrue(ContinuationCharacterBytes >= Encoding.UTF8.GetByteCount(ParagraphCharacter.ToString())); + internal void ParagraphCharacterSizeIsLessOrEqualToContinuationCharacterSize() => Assert.IsTrue(ContinuationCharacterBytes >= Encoding.UTF8.GetByteCount(ParagraphCharacter.ToString())); [TestMethod] - public async Task ProperlyEscapesCharacters() { + internal async Task ProperlyEscapesCharacters() { const string message = @"[b]bold[/b] \n"; const string escapedMessage = @"\[b]bold\[/b] \\n"; @@ -163,7 +164,7 @@ public sealed class SteamChatMessage { } [TestMethod] - public async Task ProperlyEscapesSteamMessagePrefix() { + internal async Task ProperlyEscapesSteamMessagePrefix() { const string prefix = "/pre []"; const string escapedPrefix = @"/pre \[]"; @@ -178,7 +179,7 @@ public sealed class SteamChatMessage { [DataRow(false)] [DataRow(true)] [DataTestMethod] - public async Task ProperlySplitsLongSingleLine(bool isAccountLimited) { + internal async Task ProperlySplitsLongSingleLine(bool isAccountLimited) { int maxMessageBytes = isAccountLimited ? MaxMessageBytesForLimitedAccounts : MaxMessageBytesForUnlimitedAccounts; int longLineLength = maxMessageBytes - ReservedContinuationMessageBytes; @@ -196,10 +197,10 @@ public sealed class SteamChatMessage { } [TestMethod] - public void ReservedSizeForEscapingIsProperlyCalculated() => Assert.AreEqual(ReservedEscapeMessageBytes, Encoding.UTF8.GetByteCount(@"\") + 4); // Maximum amount of bytes per single UTF-8 character is 4, not 6 as from Encoding.UTF8.GetMaxByteCount(1) + internal void ReservedSizeForEscapingIsProperlyCalculated() => Assert.AreEqual(ReservedEscapeMessageBytes, Encoding.UTF8.GetByteCount(@"\") + 4); // Maximum amount of bytes per single UTF-8 character is 4, not 6 as from Encoding.UTF8.GetMaxByteCount(1) [TestMethod] - public async Task RyzhehvostInitialTestForSplitting() { + internal async Task RyzhehvostInitialTestForSplitting() { const string prefix = "/me "; const string message = """ @@ -285,7 +286,7 @@ public sealed class SteamChatMessage { [DataRow(false)] [DataRow(true)] [DataTestMethod] - public async Task SplitsOnNewlinesWithParagraphCharacter(bool isAccountLimited) { + internal async Task SplitsOnNewlinesWithParagraphCharacter(bool isAccountLimited) { int maxMessageBytes = isAccountLimited ? MaxMessageBytesForLimitedAccounts : MaxMessageBytesForUnlimitedAccounts; StringBuilder newlinePartBuilder = new(); @@ -314,7 +315,7 @@ public sealed class SteamChatMessage { } [TestMethod] - public async Task ThrowsOnTooLongNewlinesPrefix() { + internal async Task ThrowsOnTooLongNewlinesPrefix() { string prefix = new('\n', (MaxMessagePrefixBytes / NewlineWeight) + 1); const string message = "asdf"; @@ -323,7 +324,7 @@ public sealed class SteamChatMessage { } [TestMethod] - public async Task ThrowsOnTooLongPrefix() { + internal async Task ThrowsOnTooLongPrefix() { string prefix = new('x', MaxMessagePrefixBytes + 1); const string message = "asdf"; @@ -331,3 +332,4 @@ public sealed class SteamChatMessage { await Assert.ThrowsExceptionAsync(async () => await GetMessageParts(message, prefix).ToListAsync().ConfigureAwait(false)).ConfigureAwait(false); } } +#pragma warning restore CA1812 // False positive, the class is used during MSTest diff --git a/ArchiSteamFarm.Tests/Trading.cs b/ArchiSteamFarm.Tests/Trading.cs index ca2006c9c..2d074b00d 100644 --- a/ArchiSteamFarm.Tests/Trading.cs +++ b/ArchiSteamFarm.Tests/Trading.cs @@ -28,10 +28,11 @@ using static ArchiSteamFarm.Steam.Exchange.Trading; namespace ArchiSteamFarm.Tests; +#pragma warning disable CA1812 // False positive, the class is used during MSTest [TestClass] -public sealed class Trading { +internal sealed class Trading { [TestMethod] - public void ExploitingNewSetsIsFairButNotNeutral() { + internal void ExploitingNewSetsIsFairButNotNeutral() { HashSet inventory = [ CreateItem(1, amount: 40), CreateItem(2, amount: 10), @@ -53,7 +54,7 @@ public sealed class Trading { } [TestMethod] - public void Issue3203() { + internal void Issue3203() { HashSet inventory = [ CreateItem(1, amount: 2), CreateItem(2, amount: 6), @@ -77,7 +78,7 @@ public sealed class Trading { } [TestMethod] - public void MismatchRarityIsNotFair() { + internal void MismatchRarityIsNotFair() { HashSet itemsToGive = [ CreateItem(1, rarity: EAssetRarity.Rare) ]; @@ -90,7 +91,7 @@ public sealed class Trading { } [TestMethod] - public void MismatchRealAppIDsIsNotFair() { + internal void MismatchRealAppIDsIsNotFair() { HashSet itemsToGive = [ CreateItem(1, realAppID: 570) ]; @@ -103,7 +104,7 @@ public sealed class Trading { } [TestMethod] - public void MismatchTypesIsNotFair() { + internal void MismatchTypesIsNotFair() { HashSet itemsToGive = [ CreateItem(1, type: EAssetType.Emoticon) ]; @@ -116,7 +117,7 @@ public sealed class Trading { } [TestMethod] - public void MultiGameMultiTypeBadReject() { + internal void MultiGameMultiTypeBadReject() { HashSet inventory = [ CreateItem(1, amount: 9), CreateItem(3, amount: 9, realAppID: 730, type: EAssetType.Emoticon), @@ -138,7 +139,7 @@ public sealed class Trading { } [TestMethod] - public void MultiGameMultiTypeNeutralAccept() { + internal void MultiGameMultiTypeNeutralAccept() { HashSet inventory = [ CreateItem(1, amount: 9), CreateItem(3, realAppID: 730, type: EAssetType.Emoticon) @@ -159,7 +160,7 @@ public sealed class Trading { } [TestMethod] - public void MultiGameSingleTypeBadReject() { + internal void MultiGameSingleTypeBadReject() { HashSet inventory = [ CreateItem(1, amount: 9), CreateItem(3, realAppID: 730), @@ -181,7 +182,7 @@ public sealed class Trading { } [TestMethod] - public void MultiGameSingleTypeNeutralAccept() { + internal void MultiGameSingleTypeNeutralAccept() { HashSet inventory = [ CreateItem(1, amount: 2), CreateItem(3, realAppID: 730) @@ -202,7 +203,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameAbrynosWasWrongNeutralAccept() { + internal void SingleGameAbrynosWasWrongNeutralAccept() { HashSet inventory = [ CreateItem(1), CreateItem(2, amount: 2), @@ -224,7 +225,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameDonationAccept() { + internal void SingleGameDonationAccept() { HashSet inventory = [ CreateItem(1) ]; @@ -243,7 +244,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameMultiTypeBadReject() { + internal void SingleGameMultiTypeBadReject() { HashSet inventory = [ CreateItem(1, amount: 9), CreateItem(3, amount: 9, type: EAssetType.Emoticon), @@ -265,7 +266,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameMultiTypeNeutralAccept() { + internal void SingleGameMultiTypeNeutralAccept() { HashSet inventory = [ CreateItem(1, amount: 9), CreateItem(3, type: EAssetType.Emoticon) @@ -286,7 +287,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameQuantityBadReject() { + internal void SingleGameQuantityBadReject() { HashSet inventory = [ CreateItem(1), CreateItem(2), @@ -308,7 +309,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameQuantityBadReject2() { + internal void SingleGameQuantityBadReject2() { HashSet inventory = [ CreateItem(1), CreateItem(2, amount: 2) @@ -328,7 +329,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameQuantityNeutralAccept() { + internal void SingleGameQuantityNeutralAccept() { HashSet inventory = [ CreateItem(1, amount: 2), CreateItem(2) @@ -348,7 +349,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeBadReject() { + internal void SingleGameSingleTypeBadReject() { HashSet inventory = [ CreateItem(1), CreateItem(2) @@ -367,7 +368,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeBadWithOverpayingReject() { + internal void SingleGameSingleTypeBadWithOverpayingReject() { HashSet inventory = [ CreateItem(1, amount: 2), CreateItem(2, amount: 2), @@ -388,7 +389,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeBigDifferenceAccept() { + internal void SingleGameSingleTypeBigDifferenceAccept() { HashSet inventory = [ CreateItem(1), CreateItem(2, amount: 5), @@ -408,7 +409,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeBigDifferenceReject() { + internal void SingleGameSingleTypeBigDifferenceReject() { HashSet inventory = [ CreateItem(1), CreateItem(2, amount: 2), @@ -432,7 +433,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeGoodAccept() { + internal void SingleGameSingleTypeGoodAccept() { HashSet inventory = [ CreateItem(1, amount: 2) ]; @@ -450,7 +451,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeNeutralAccept() { + internal void SingleGameSingleTypeNeutralAccept() { HashSet inventory = [ CreateItem(1) ]; @@ -468,7 +469,7 @@ public sealed class Trading { } [TestMethod] - public void SingleGameSingleTypeNeutralWithOverpayingAccept() { + internal void SingleGameSingleTypeNeutralWithOverpayingAccept() { HashSet inventory = [ CreateItem(1, amount: 2), CreateItem(2, amount: 2) @@ -488,7 +489,7 @@ public sealed class Trading { } [TestMethod] - public void TakingExcessiveAmountOfSingleCardCanStillBeFairAndNeutral() { + internal void TakingExcessiveAmountOfSingleCardCanStillBeFairAndNeutral() { HashSet inventory = [ CreateItem(1, amount: 52), CreateItem(2, amount: 73), @@ -515,3 +516,4 @@ public sealed class Trading { private static Asset CreateItem(ulong classID, ulong instanceID = 0, uint amount = 1, bool marketable = false, bool tradable = false, uint realAppID = Asset.SteamAppID, EAssetType type = EAssetType.TradingCard, EAssetRarity rarity = EAssetRarity.Common) => new(Asset.SteamAppID, Asset.SteamCommunityContextID, classID, amount, new InventoryDescription(Asset.SteamAppID, classID, instanceID, marketable, tradable, realAppID, type, rarity)); } +#pragma warning restore CA1812 // False positive, the class is used during MSTest diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 921fc5b11..06092b951 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -187,7 +187,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable { private IEnumerable<(string FilePath, EFileType FileType)> RelatedFiles { get { - foreach (EFileType fileType in Enum.GetValues(typeof(EFileType))) { + foreach (EFileType fileType in Enum.GetValues()) { string filePath = GetFilePath(fileType); if (string.IsNullOrEmpty(filePath)) { diff --git a/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs b/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs index 6459e4c11..3ef7590f5 100644 --- a/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs +++ b/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs @@ -920,7 +920,7 @@ public sealed class CardsFarmer : IAsyncDisposable, IDisposable { return keepFarming; } - private async Task FarmHours(IReadOnlyCollection games) { + private async Task FarmHours(HashSet games) { if ((games == null) || (games.Count == 0)) { throw new ArgumentNullException(nameof(games)); } @@ -979,7 +979,7 @@ public sealed class CardsFarmer : IAsyncDisposable, IDisposable { return keepFarming; } - private async Task FarmMultiple(IReadOnlyCollection games) { + private async Task FarmMultiple(HashSet games) { if ((games == null) || (games.Count == 0)) { throw new ArgumentNullException(nameof(games)); } diff --git a/ArchiSteamFarm/Steam/Interaction/Commands.cs b/ArchiSteamFarm/Steam/Interaction/Commands.cs index fa967629f..d2669a10d 100644 --- a/ArchiSteamFarm/Steam/Interaction/Commands.cs +++ b/ArchiSteamFarm/Steam/Interaction/Commands.cs @@ -1976,7 +1976,7 @@ public sealed class Commands { return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null; } - private async Task ResponsePlay(EAccess access, IReadOnlyCollection gameIDs, string? gameName = null) { + private async Task ResponsePlay(EAccess access, HashSet gameIDs, string? gameName = null) { if (!Enum.IsDefined(access)) { throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess)); } @@ -2965,7 +2965,7 @@ public sealed class Commands { return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null; } - private async Task ResponseTransferByRealAppIDs(EAccess access, IReadOnlyCollection realAppIDs, Bot targetBot, bool exclude) { + private async Task ResponseTransferByRealAppIDs(EAccess access, HashSet realAppIDs, Bot targetBot, bool exclude) { if (!Enum.IsDefined(access)) { throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess)); } diff --git a/ArchiSteamFarm/Steam/Storage/BotDatabase.cs b/ArchiSteamFarm/Steam/Storage/BotDatabase.cs index 97201a52d..dc54ded52 100644 --- a/ArchiSteamFarm/Steam/Storage/BotDatabase.cs +++ b/ArchiSteamFarm/Steam/Storage/BotDatabase.cs @@ -318,8 +318,6 @@ public sealed class BotDatabase : GenericDatabase { } internal static bool IsValidGameToRedeemInBackground(DictionaryEntry game) { - ArgumentNullException.ThrowIfNull(game); - string? key = game.Key as string; if (string.IsNullOrEmpty(key) || !Utilities.IsValidCdKey(key)) {