From 7a56596277d1f7543ba8b183a418ba7926343ac8 Mon Sep 17 00:00:00 2001 From: Nicholas Martini Date: Thu, 17 Jun 2021 18:15:35 +0200 Subject: [PATCH] Minor code refactoring. --- DuolingoNET/Duolingo.cs | 14 +++++++------- DuolingoNET/Lexeme.cs | 2 -- DuolingoNET/User.cs | 2 -- DuolingoNET/Vocabulary.cs | 1 - 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/DuolingoNET/Duolingo.cs b/DuolingoNET/Duolingo.cs index c8432fc..540e5d7 100644 --- a/DuolingoNET/Duolingo.cs +++ b/DuolingoNET/Duolingo.cs @@ -40,12 +40,12 @@ public class Duolingo /// /// A string representing the username or email of the account. /// - public string Username { get; set; } + public string LoginUsername { get; set; } /// /// A string representing the password of the account. /// - public string Password { get; set; } + public string LoginPassword { get; set; } /// /// The used throughout the library. @@ -87,8 +87,8 @@ public Duolingo() /// A string representing the password of the account. public Duolingo(string username, string password) { - Username = username; - Password = password; + LoginUsername = username; + LoginPassword = password; Initialize(); @@ -195,7 +195,7 @@ private async Task LoginAsync() homePageResult.Result.EnsureSuccessStatusCode(); // Formats the JSON string used for authentication - var jsonString = string.Format(@"{{""login"":""{0}"",""password"":""{1}""}}", Username, Password); + var jsonString = string.Format(@"{{""login"":""{0}"",""password"":""{1}""}}", LoginUsername, LoginPassword); HttpContent content = new StringContent(jsonString, Encoding.UTF8, "application/json"); // Logs in and ensures success @@ -216,8 +216,8 @@ private void ReadLoginData() string json = r.ReadToEnd(); dynamic loginData = JsonConvert.DeserializeObject(json); - Username = loginData.login; - Password = loginData.password; + LoginUsername = loginData.login; + LoginPassword = loginData.password; } } diff --git a/DuolingoNET/Lexeme.cs b/DuolingoNET/Lexeme.cs index 2c8786f..0239a54 100644 --- a/DuolingoNET/Lexeme.cs +++ b/DuolingoNET/Lexeme.cs @@ -1,7 +1,5 @@ using Newtonsoft.Json; -using System; using System.Collections.Generic; -using System.Text; namespace DuolingoNET { diff --git a/DuolingoNET/User.cs b/DuolingoNET/User.cs index 5ed2624..60a17e5 100644 --- a/DuolingoNET/User.cs +++ b/DuolingoNET/User.cs @@ -1,7 +1,5 @@ using Newtonsoft.Json; -using System; using System.Collections.Generic; -using System.Text; namespace DuolingoNET { diff --git a/DuolingoNET/Vocabulary.cs b/DuolingoNET/Vocabulary.cs index 06fd9fd..90cfcbc 100644 --- a/DuolingoNET/Vocabulary.cs +++ b/DuolingoNET/Vocabulary.cs @@ -1,7 +1,6 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; -using System.Text; namespace DuolingoNET {