|
10 | 10 | using SteamKit2; |
11 | 11 | using static SteamKit2.SteamApps; |
12 | 12 |
|
13 | | -#pragma warning disable CA1031 // Do not catch general exception types |
14 | 13 | namespace SteamTokenDumper; |
15 | 14 |
|
16 | 15 | internal sealed class Requester(Payload payload, SteamApps steamApps, KnownDepotIds knownDepotIds, Configuration config) |
@@ -152,7 +151,7 @@ await AnsiConsole.Progress() |
152 | 151 |
|
153 | 152 | foreach (var chunk in subInfoRequests.Chunk(ItemsPerRequest)) |
154 | 153 | { |
155 | | - AsyncJobMultiple<PICSProductInfoCallback>.ResultSet info = null; |
| 154 | + AsyncJobMultiple<PICSProductInfoCallback>.ResultSet? info = null; |
156 | 155 |
|
157 | 156 | for (var retry = 3; retry > 0; retry--) |
158 | 157 | { |
@@ -259,7 +258,7 @@ private async Task Request(ProgressTask progress, ProgressTask progressTokens, P |
259 | 258 |
|
260 | 259 | foreach (var chunk in ownedApps.Chunk(ItemsPerRequest)) |
261 | 260 | { |
262 | | - PICSTokensCallback tokens = null; |
| 261 | + PICSTokensCallback? tokens = null; |
263 | 262 |
|
264 | 263 | for (var retry = 3; retry > 0; retry--) |
265 | 264 | { |
@@ -354,7 +353,7 @@ async Task CheckFinishedDepotKeyRequests() |
354 | 353 |
|
355 | 354 | foreach (var chunk in appInfoRequests.AsEnumerable().Reverse().Chunk(ItemsPerRequest)) |
356 | 355 | { |
357 | | - AsyncJobMultiple<PICSProductInfoCallback>.ResultSet appInfo = null; |
| 356 | + AsyncJobMultiple<PICSProductInfoCallback>.ResultSet? appInfo = null; |
358 | 357 |
|
359 | 358 | for (var retry = 3; retry > 0; retry--) |
360 | 359 | { |
@@ -517,20 +516,25 @@ public static async Task<List<uint>> GetOwnedFromStore(SteamClient steamClient, |
517 | 516 |
|
518 | 517 | try |
519 | 518 | { |
520 | | - var newToken = await steamClient.Authentication.GenerateAccessTokenForAppAsync(steamClient.SteamID, refreshToken, allowRenewal: false); |
| 519 | + var steamid = steamClient.SteamID; |
| 520 | + ArgumentNullException.ThrowIfNull(steamid); |
| 521 | + |
| 522 | + var newToken = await steamClient.Authentication.GenerateAccessTokenForAppAsync(steamid, refreshToken, allowRenewal: false); |
521 | 523 |
|
522 | 524 | ArgumentNullException.ThrowIfNullOrEmpty(newToken.AccessToken); |
523 | 525 |
|
524 | 526 | using var requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://store.steampowered.com/dynamicstore/userdata"); |
525 | 527 |
|
526 | | - var cookie = string.Concat(steamClient.SteamID.ConvertToUInt64().ToString(), "||", newToken.AccessToken); |
| 528 | + var cookie = string.Concat(steamid.ConvertToUInt64().ToString(), "||", newToken.AccessToken); |
527 | 529 | requestMessage.Headers.Add("Cookie", string.Concat("steamLoginSecure=", WebUtility.UrlEncode(cookie))); |
528 | 530 |
|
529 | 531 | var response = await httpClient.SendAsync(requestMessage); |
530 | 532 | response.EnsureSuccessStatusCode(); |
531 | 533 |
|
532 | 534 | var data = await response.Content.ReadFromJsonAsync(StoreUserDataJsonContext.Default.StoreUserData); |
533 | 535 |
|
| 536 | + ArgumentNullException.ThrowIfNull(data); |
| 537 | + |
534 | 538 | AnsiConsole.WriteLine($"Store says you own {data.OwnedPackages.Count} licenses."); |
535 | 539 |
|
536 | 540 | return data.OwnedPackages; |
|
0 commit comments