From 712a8a1138a0d943f869c021ede6801706b1f2b4 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 10 Sep 2017 14:13:46 -0400 Subject: [PATCH] avoid repeating code --- Program.cs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Program.cs b/Program.cs index 3dca05d..d95b727 100644 --- a/Program.cs +++ b/Program.cs @@ -737,23 +737,7 @@ namespace SteamGuard for (int i = 0; i < SteamGuardAccounts.Length; i++) { SteamGuardAccount account = SteamGuardAccounts[i]; - 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; - } - } - else + if ((user != "" && account.AccountName.ToLower() == user.ToLower()) || user == "") { Console.WriteLine($"Accepting Confirmations on {account.AccountName}"); if (Verbose) Console.WriteLine("Refeshing Session..."); @@ -764,6 +748,10 @@ namespace SteamGuard Confirmation[] confirmations = tradesTask.Result; if (Verbose) Console.WriteLine("Accepting Confirmations..."); account.AcceptMultipleConfirmations(confirmations); + if (user != "") + { + break; + } } } }