avoid repeating code

This commit is contained in:
Carson McManus 2017-09-10 14:13:46 -04:00
parent a0ae3ac369
commit 712a8a1138

View file

@ -737,34 +737,22 @@ namespace SteamGuard
for (int i = 0; i < SteamGuardAccounts.Length; i++) for (int i = 0; i < SteamGuardAccounts.Length; i++)
{ {
SteamGuardAccount account = SteamGuardAccounts[i]; SteamGuardAccount account = SteamGuardAccounts[i];
if ((user != "" && account.AccountName.ToLower() == user.ToLower()) || user == "")
{
Console.WriteLine($"Accepting Confirmations on {account.AccountName}");
if (Verbose) Console.WriteLine("Refeshing Session...");
account.RefreshSession();
if (Verbose) Console.WriteLine("Fetching Confirmations...");
var tradesTask = account.FetchConfirmationsAsync();
tradesTask.Wait();
Confirmation[] confirmations = tradesTask.Result;
if (Verbose) Console.WriteLine("Accepting Confirmations...");
account.AcceptMultipleConfirmations(confirmations);
if (user != "") if (user != "")
{ {
if (account.AccountName.ToLower() == user.ToLower())
{
Console.WriteLine($"Accepting Confirmations on {account.AccountName}");
if (Verbose) Console.WriteLine("Refeshing Session...");
account.RefreshSession();
if (Verbose) Console.WriteLine("Fetching Confirmations...");
var tradesTask = account.FetchConfirmationsAsync();
tradesTask.Wait();
Confirmation[] confirmations = tradesTask.Result;
if (Verbose) Console.WriteLine("Accepting Confirmations...");
account.AcceptMultipleConfirmations(confirmations);
break; break;
} }
} }
else
{
Console.WriteLine($"Accepting Confirmations on {account.AccountName}");
if (Verbose) Console.WriteLine("Refeshing Session...");
account.RefreshSession();
if (Verbose) Console.WriteLine("Fetching Confirmations...");
var tradesTask = account.FetchConfirmationsAsync();
tradesTask.Wait();
Confirmation[] confirmations = tradesTask.Result;
if (Verbose) Console.WriteLine("Accepting Confirmations...");
account.AcceptMultipleConfirmations(confirmations);
}
} }
} }
} }