Mist optimization

No need to initialize assetIDs if inventory is empty. Also we know exact amount of items this way.
This commit is contained in:
JustArchi
2021-02-20 23:49:05 +01:00
parent e87ef9498a
commit 835611547f

View File

@@ -149,7 +149,7 @@ namespace ArchiSteamFarm {
ulong startAssetID = 0;
// We need to store asset IDs to make sure we won't get duplicate items
HashSet<ulong> assetIDs = new();
HashSet<ulong>? assetIDs = null;
while (true) {
await ASF.InventorySemaphore.WaitAsync().ConfigureAwait(false);
@@ -170,6 +170,8 @@ namespace ArchiSteamFarm {
yield break;
}
assetIDs ??= new HashSet<ulong>((int) response.Content.TotalInventoryCount);
if ((response.Content.Assets.Count == 0) || (response.Content.Descriptions.Count == 0)) {
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings.ErrorObjectIsNull, nameof(response.Content.Assets) + " || " + nameof(response.Content.Descriptions)));
}