Skip to content

Commit

Permalink
Minor code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktheone committed Jun 17, 2021
1 parent eff3551 commit 7a56596
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
14 changes: 7 additions & 7 deletions DuolingoNET/Duolingo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public class Duolingo
/// <summary>
/// A string representing the username or email of the account.
/// </summary>
public string Username { get; set; }
public string LoginUsername { get; set; }

/// <summary>
/// A string representing the password of the account.
/// </summary>
public string Password { get; set; }
public string LoginPassword { get; set; }

/// <summary>
/// The <see cref="HttpClient"/> used throughout the library.
Expand Down Expand Up @@ -87,8 +87,8 @@ public Duolingo()
/// <param name="password">A string representing the password of the account.</param>
public Duolingo(string username, string password)
{
Username = username;
Password = password;
LoginUsername = username;
LoginPassword = password;

Initialize();

Expand Down Expand Up @@ -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
Expand All @@ -216,8 +216,8 @@ private void ReadLoginData()
string json = r.ReadToEnd();
dynamic loginData = JsonConvert.DeserializeObject<dynamic>(json);

Username = loginData.login;
Password = loginData.password;
LoginUsername = loginData.login;
LoginPassword = loginData.password;
}
}

Expand Down
2 changes: 0 additions & 2 deletions DuolingoNET/Lexeme.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace DuolingoNET
{
Expand Down
2 changes: 0 additions & 2 deletions DuolingoNET/User.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace DuolingoNET
{
Expand Down
1 change: 0 additions & 1 deletion DuolingoNET/Vocabulary.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace DuolingoNET
{
Expand Down

0 comments on commit 7a56596

Please sign in to comment.