From cca21900a67f21c3b22bec22dbf5a7a25dbf10ab Mon Sep 17 00:00:00 2001 From: Archi Date: Thu, 19 Jan 2023 15:06:06 +0100 Subject: [PATCH] Allow STD requests to fail, and continue with other ones --- .../SteamTokenDumperPlugin.cs | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs index 486683728..d5349a582 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs @@ -362,6 +362,10 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC using (HashSet.Enumerator enumerator = appIDsToRefresh.GetEnumerator()) { while (true) { + if (!bot.IsConnectedAndLoggedOn) { + return; + } + while ((appIDsThisRound.Count < SharedInfo.AppInfosPerSingleRequest) && enumerator.MoveNext()) { appIDsThisRound.Add(enumerator.Current); } @@ -370,10 +374,6 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC break; } - if (!bot.IsConnectedAndLoggedOn) { - return; - } - bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotRetrievingAppAccessTokens, appIDsThisRound.Count)); SteamApps.PICSTokensCallback response; @@ -383,7 +383,9 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC } catch (Exception e) { bot.ArchiLogger.LogGenericWarningException(e); - return; + appIDsThisRound.Clear(); + + continue; } bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotFinishedRetrievingAppAccessTokens, appIDsThisRound.Count)); @@ -399,6 +401,10 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC using (HashSet.Enumerator enumerator = appIDsToRefresh.GetEnumerator()) { while (true) { + if (!bot.IsConnectedAndLoggedOn) { + return; + } + while ((appIDsThisRound.Count < SharedInfo.AppInfosPerSingleRequest) && enumerator.MoveNext()) { appIDsThisRound.Add(enumerator.Current); } @@ -407,10 +413,6 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC break; } - if (!bot.IsConnectedAndLoggedOn) { - return; - } - bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotRetrievingAppInfos, appIDsThisRound.Count)); AsyncJobMultiple.ResultSet response; @@ -420,7 +422,9 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC } catch (Exception e) { bot.ArchiLogger.LogGenericWarningException(e); - return; + appIDsThisRound.Clear(); + + continue; } if (response.Results == null) { @@ -461,7 +465,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotC } catch (Exception e) { bot.ArchiLogger.LogGenericWarningException(e); - return; + continue; } bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.BotFinishedRetrievingDepotKeys, depotTasks.Count));