CAN WE STOP ALREADY

This commit is contained in:
JustArchi
2022-06-15 19:16:25 +02:00
parent dcebde55a2
commit c753ed24cd

View File

@@ -2646,9 +2646,15 @@ public sealed class Bot : IAsyncDisposable {
Dictionary<uint, ulong> packageAccessTokens = new();
Dictionary<uint, uint> packagesToRefresh = new();
bool hasNewEntries = false;
foreach (SteamApps.LicenseListCallback.License license in callback.LicenseList.GroupBy(static license => license.PackageID, static (_, licenses) => licenses.OrderByDescending(static license => license.TimeCreated).First())) {
ownedPackageIDs[license.PackageID] = (license.PaymentMethod, license.TimeCreated);
if (!OwnedPackageIDs.ContainsKey(license.PackageID)) {
hasNewEntries = true;
}
if (!ASF.GlobalDatabase.PackageAccessTokensReadOnly.TryGetValue(license.PackageID, out ulong packageAccessToken) || (packageAccessToken != license.AccessToken)) {
packageAccessTokens[license.PackageID] = license.AccessToken;
@@ -2659,9 +2665,6 @@ public sealed class Bot : IAsyncDisposable {
}
}
HashSet<uint> newEntries = ownedPackageIDs.Keys.ToHashSet();
newEntries.ExceptWith(OwnedPackageIDs.Keys);
OwnedPackageIDs = ownedPackageIDs.ToImmutableDictionary();
if (packageAccessTokens.Count > 0) {
@@ -2674,7 +2677,7 @@ public sealed class Bot : IAsyncDisposable {
ArchiLogger.LogGenericTrace(Strings.Done);
}
if (newEntries.Count > 0) {
if (hasNewEntries) {
await CardsFarmer.OnNewGameAdded().ConfigureAwait(false);
}
}