Fix for multiple licenses for the same package

This commit is contained in:
JustArchi 2020-06-13 21:45:37 +02:00
parent 574e8739c1
commit 6804f5b5f7
2 changed files with 2 additions and 2 deletions

View file

@ -197,7 +197,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
throw new ArgumentNullException(nameof(GlobalCache));
}
Dictionary<uint, ulong> packageTokens = callback.LicenseList.ToDictionary(license => license.PackageID, license => license.AccessToken);
Dictionary<uint, ulong> packageTokens = callback.LicenseList.GroupBy(license => license.PackageID).ToDictionary(group => group.Key, group => group.OrderByDescending(license => license.TimeCreated).First().AccessToken);
await GlobalCache.UpdatePackageTokens(packageTokens).ConfigureAwait(false);
await Refresh(bot, packageTokens.Keys).ConfigureAwait(false);

View file

@ -2376,7 +2376,7 @@ namespace ArchiSteamFarm {
Dictionary<uint, ulong> packageAccessTokens = new Dictionary<uint, ulong>();
Dictionary<uint, uint> packagesToRefresh = new Dictionary<uint, uint>();
foreach (SteamApps.LicenseListCallback.License license in callback.LicenseList) {
foreach (SteamApps.LicenseListCallback.License license in callback.LicenseList.GroupBy(license => license.PackageID).Select(group => group.OrderByDescending(license => license.TimeCreated).First())) {
OwnedPackageIDs[license.PackageID] = (license.PaymentMethod, license.TimeCreated);
if (!ASF.GlobalDatabase.PackageAccessTokensReadOnly.TryGetValue(license.PackageID, out ulong packageAccessToken) || (packageAccessToken != license.AccessToken)) {