mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Optimize memory usage
This commit is contained in:
parent
4582c40dbe
commit
555a74e2b6
3 changed files with 6 additions and 9 deletions
|
@ -1059,7 +1059,7 @@ namespace ArchiSteamFarm {
|
|||
Bot.ArchiLogger.LogGenericInfo(Strings.Success);
|
||||
|
||||
// Unlock Steam Parental if needed
|
||||
if (!string.IsNullOrEmpty(parentalCode) && (parentalCode.Length == 4)) {
|
||||
if ((parentalCode != null) && (parentalCode.Length == 4)) {
|
||||
if (!await UnlockParentalAccount(parentalCode).ConfigureAwait(false)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1130,12 +1130,7 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
|
||||
uint? level = await Bot.ArchiHandler.GetLevel().ConfigureAwait(false);
|
||||
|
||||
if (!level.HasValue) {
|
||||
return FormatBotResponse(Strings.WarningFailed);
|
||||
}
|
||||
|
||||
return FormatBotResponse(string.Format(Strings.BotLevel, level.Value));
|
||||
return FormatBotResponse(level.HasValue ? string.Format(Strings.BotLevel, level.Value) : Strings.WarningFailed);
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseLevel(ulong steamID, string botNames) {
|
||||
|
|
|
@ -275,10 +275,12 @@ namespace ArchiSteamFarm {
|
|||
byte emptyMatches = 0;
|
||||
HashSet<(uint AppID, Steam.Asset.EType Type)> skippedSetsThisRound = new HashSet<(uint AppID, Steam.Asset.EType Type)>();
|
||||
|
||||
foreach (ListedUser listedUser in listedUsers.Where(listedUser => listedUser.MatchEverything && listedUser.MatchableTypes.Any(acceptedMatchableTypes.Contains) && !Bot.IsBlacklistedFromTrades(listedUser.SteamID)).OrderByDescending(listedUser => listedUser.Score).Take(MaxMatchedBotsHard)) {
|
||||
foreach (ListedUser listedUser in listedUsers.Where(listedUser => listedUser.MatchEverything && acceptedMatchableTypes.Any(listedUser.MatchableTypes.Contains) && !Bot.IsBlacklistedFromTrades(listedUser.SteamID)).OrderByDescending(listedUser => listedUser.Score).Take(MaxMatchedBotsHard)) {
|
||||
Bot.ArchiLogger.LogGenericTrace(listedUser.SteamID + "...");
|
||||
|
||||
HashSet<Steam.Asset> theirInventory = await Bot.ArchiWebHandler.GetInventory(listedUser.SteamID, tradable: true, wantedTypes: acceptedMatchableTypes, skippedSets: skippedSetsThisRound).ConfigureAwait(false);
|
||||
HashSet<Steam.Asset.EType> sharedTypes = acceptedMatchableTypes.Where(listedUser.MatchableTypes.Contains).ToHashSet();
|
||||
|
||||
HashSet<Steam.Asset> theirInventory = await Bot.ArchiWebHandler.GetInventory(listedUser.SteamID, tradable: true, wantedTypes: sharedTypes, skippedSets: skippedSetsThisRound).ConfigureAwait(false);
|
||||
if ((theirInventory == null) || (theirInventory.Count == 0)) {
|
||||
Bot.ArchiLogger.LogGenericTrace(string.Format(Strings.ErrorIsEmpty, nameof(theirInventory)));
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue