From 0eae895676268546fdf2160ea8daf9f05a5f24dc Mon Sep 17 00:00:00 2001 From: JustArchi Date: Thu, 10 Mar 2016 21:11:54 +0100 Subject: [PATCH] SteamAuth update --- SteamAuth/Confirmation.cs | 27 ++++++++++++++++++++++++--- SteamAuth/SteamGuardAccount.cs | 26 +++++++++++++------------- SteamAuth/UserLogin.cs | 2 -- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/SteamAuth/Confirmation.cs b/SteamAuth/Confirmation.cs index 7b437d4ee..1035446ea 100644 --- a/SteamAuth/Confirmation.cs +++ b/SteamAuth/Confirmation.cs @@ -8,8 +8,29 @@ namespace SteamAuth { public class Confirmation { - public string ConfirmationID; - public string ConfirmationKey; - public string ConfirmationDescription; + public string ID; + public string Key; + public string Description; + + public ConfirmationType ConfType + { + get + { + if (String.IsNullOrEmpty(Description)) return ConfirmationType.Unknown; + if (Description.StartsWith("Confirm ")) return ConfirmationType.GenericConfirmation; + if (Description.StartsWith("Trade with ")) return ConfirmationType.Trade; + if (Description.StartsWith("Sell -")) return ConfirmationType.MarketSellTransaction; + + return ConfirmationType.Unknown; + } + } + + public enum ConfirmationType + { + GenericConfirmation, + Trade, + MarketSellTransaction, + Unknown + } } } diff --git a/SteamAuth/SteamGuardAccount.cs b/SteamAuth/SteamGuardAccount.cs index 36f13625f..8af6b7ce3 100644 --- a/SteamAuth/SteamGuardAccount.cs +++ b/SteamAuth/SteamGuardAccount.cs @@ -71,7 +71,7 @@ namespace SteamAuth if (removeResponse == null || removeResponse.Response == null || !removeResponse.Response.Success) return false; return true; } - catch (Exception e) + catch (Exception) { return false; } @@ -115,7 +115,7 @@ namespace SteamAuth codePoint /= steamGuardCodeTranslations.Length; } } - catch (Exception e) + catch (Exception) { return null; //Change later, catch-alls are bad! } @@ -162,9 +162,9 @@ namespace SteamAuth string confDesc = confDescs[i].Groups[1].Value; Confirmation conf = new Confirmation() { - ConfirmationDescription = confDesc, - ConfirmationID = confID, - ConfirmationKey = confKey + Description = confDesc, + ID = confID, + Key = confKey }; ret.Add(conf); } @@ -212,9 +212,9 @@ namespace SteamAuth string confDesc = confDescs[i].Groups[1].Value; Confirmation conf = new Confirmation() { - ConfirmationDescription = confDesc, - ConfirmationID = confID, - ConfirmationKey = confKey + Description = confDesc, + ID = confID, + Key = confKey }; ret.Add(conf); } @@ -268,7 +268,7 @@ namespace SteamAuth this.Session.SteamLoginSecure = tokenSecure; return true; } - catch (Exception e) + catch (Exception) { return false; } @@ -300,7 +300,7 @@ namespace SteamAuth this.Session.SteamLoginSecure = tokenSecure; return true; } - catch (Exception e) + catch (Exception) { return false; } @@ -308,7 +308,7 @@ namespace SteamAuth private ConfirmationDetailsResponse _getConfirmationDetails(Confirmation conf) { - string url = APIEndpoints.COMMUNITY_BASE + "/mobileconf/details/" + conf.ConfirmationID + "?"; + string url = APIEndpoints.COMMUNITY_BASE + "/mobileconf/details/" + conf.ID + "?"; string queryString = GenerateConfirmationQueryParams("details"); url += queryString; @@ -329,7 +329,7 @@ namespace SteamAuth string url = APIEndpoints.COMMUNITY_BASE + "/mobileconf/ajaxop"; string queryString = "?op=" + op + "&"; queryString += GenerateConfirmationQueryParams(op); - queryString += "&cid=" + conf.ConfirmationID + "&ck=" + conf.ConfirmationKey; + queryString += "&cid=" + conf.ID + "&ck=" + conf.Key; url += queryString; CookieContainer cookies = new CookieContainer(); @@ -401,7 +401,7 @@ namespace SteamAuth string hash = WebUtility.UrlEncode(encodedData); return hash; } - catch (Exception e) + catch (Exception) { return null; //Fix soon: catch-all is BAD! } diff --git a/SteamAuth/UserLogin.cs b/SteamAuth/UserLogin.cs index 1e4ea024b..a298d2166 100644 --- a/SteamAuth/UserLogin.cs +++ b/SteamAuth/UserLogin.cs @@ -161,8 +161,6 @@ namespace SteamAuth this.LoggedIn = true; return LoginResult.LoginOkay; } - - return LoginResult.GeneralFailure; } private class LoginResponse