From ad112cbbc52b1d6a9495e0c93548326481b02d30 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Oct 2021 14:28:29 +0900 Subject: [PATCH] Fix intendation in a way it doesn't regress with older `inspectcode` --- osu.Game/Online/API/OAuth.cs | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 0dbc3b02db..1feb3076d1 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -39,17 +39,19 @@ namespace osu.Game.Online.API if (string.IsNullOrEmpty(username)) throw new ArgumentException("Missing username."); if (string.IsNullOrEmpty(password)) throw new ArgumentException("Missing password."); - using (var req = new AccessTokenRequestPassword(username, password) - { - Url = $@"{endpoint}/oauth/token", - Method = HttpMethod.Post, - ClientId = clientId, - ClientSecret = clientSecret - }) + var accessTokenRequest = new AccessTokenRequestPassword(username, password) + { + Url = $@"{endpoint}/oauth/token", + Method = HttpMethod.Post, + ClientId = clientId, + ClientSecret = clientSecret + }; + + using (accessTokenRequest) { try { - req.Perform(); + accessTokenRequest.Perform(); } catch (Exception ex) { @@ -60,7 +62,7 @@ namespace osu.Game.Online.API try { // attempt to decode a displayable error string. - var error = JsonConvert.DeserializeObject(req.GetResponseString() ?? string.Empty); + var error = JsonConvert.DeserializeObject(accessTokenRequest.GetResponseString() ?? string.Empty); if (error != null) throwableException = new APIException(error.UserDisplayableError, ex); } @@ -71,7 +73,7 @@ namespace osu.Game.Online.API throw throwableException; } - Token.Value = req.ResponseObject; + Token.Value = accessTokenRequest.ResponseObject; } } @@ -79,17 +81,19 @@ namespace osu.Game.Online.API { try { - using (var req = new AccessTokenRequestRefresh(refresh) - { - Url = $@"{endpoint}/oauth/token", - Method = HttpMethod.Post, - ClientId = clientId, - ClientSecret = clientSecret - }) + var refreshRequest = new AccessTokenRequestRefresh(refresh) { - req.Perform(); + Url = $@"{endpoint}/oauth/token", + Method = HttpMethod.Post, + ClientId = clientId, + ClientSecret = clientSecret + }; - Token.Value = req.ResponseObject; + using (refreshRequest) + { + refreshRequest.Perform(); + + Token.Value = refreshRequest.ResponseObject; return true; } }