fix #11 again, this time for accept-all

This commit is contained in:
Carson McManus 2018-03-27 19:20:21 -04:00
parent 8f9cbda78e
commit 62a5817376

View file

@ -553,17 +553,8 @@ namespace SteamGuard
Ignore = -1
}
static void processConfirmations(SteamGuardAccount account)
static bool promptRefreshSession(SteamGuardAccount account)
{
Utils.Verbose("Refeshing Session...");
if (account.RefreshSession())
{
Utils.Verbose("Session refreshed");
Manifest.SaveAccount(account, Manifest.Encrypted);
}
else
{
Utils.Verbose("Failed to refresh session");
Console.WriteLine("Your Steam credentials have expired. For trade and market confirmations to work properly, please login again.");
string username = account.AccountName;
Console.WriteLine($"Username: {username}");
@ -592,11 +583,28 @@ namespace SteamGuard
{
Utils.Verbose("Session refreshed");
Manifest.SaveAccount(account, Manifest.Encrypted);
return true;
}
else
{
return false;
}
}
static void processConfirmations(SteamGuardAccount account)
{
Utils.Verbose("Refeshing Session...");
if (account.RefreshSession())
{
Utils.Verbose("Session refreshed");
Manifest.SaveAccount(account, Manifest.Encrypted);
}
else
{
Utils.Verbose("Failed to refresh session, prompting user...");
if (!promptRefreshSession(account))
{
Console.WriteLine("Failed to refresh session, aborting...");
return;
}
}
Console.WriteLine("Retrieving trade confirmations...");
@ -745,7 +753,19 @@ namespace SteamGuard
{
Console.WriteLine($"Accepting Confirmations on {account.AccountName}");
Utils.Verbose("Refeshing Session...");
account.RefreshSession();
if (account.RefreshSession())
{
Utils.Verbose("Session refreshed");
Manifest.SaveAccount(account, Manifest.Encrypted);
}
else
{
Utils.Verbose("Failed to refresh session, prompting user...");
if (!promptRefreshSession(account))
{
Console.WriteLine("Failed to refresh session, aborting...");
}
}
Utils.Verbose("Fetching Confirmations...");
var tradesTask = account.FetchConfirmationsAsync();
tradesTask.Wait();