Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
Fix maple ID switching
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholastay committed Jul 8, 2020
1 parent 02b9519 commit 4fd2ebd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions MapleGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class MapleGame

private string ngmPath;
private string launchWID;

private string tespiaWID;

private HttpClient webClient => Account.WebClient;
Expand Down Expand Up @@ -187,19 +186,30 @@ private async Task<bool> getCurrentMaple()
if (imgM.Success)
CharacterImageUrl = imgM.Groups[1].Value.Replace("/180", "");

Match switchM = mapleIdSwitchTokenRegex.Match(data);
if (switchM.Success)
mapleIdSwitchToken = switchM.Groups[1].Value;

return true;
}

private Regex mapleIdsRegex = new Regex(">(.+?)<\\/a>");
private Regex mapleIdSwitchTokenRegex = new Regex("name=\"__RequestVerificationToken\".*value=\"(.+?)\"");
private string mapleIdSwitchToken = null;
public async Task GetMapleIds()
{
HttpRequestMessage req = new HttpRequestMessage()
{
Method = HttpMethod.Get,
Method = HttpMethod.Post,
RequestUri = new Uri("https://maplestory.nexon.game.naver.com/Authentication/Email/IDList")
};
req.Headers.Add("Referer", MAPLE_HOME);
req.Headers.Add("X-Requested-With", "XMLHttpRequest");
var _postData = new Dictionary<string, string>
{
{ "__RequestVerificationToken", mapleIdSwitchToken }
};
var postData = new FormUrlEncodedContent(_postData);
req.Content = postData;

HttpResponseMessage res = await webClient.SendAsync(req);
res.EnsureSuccessStatusCode();
Expand Down

0 comments on commit 4fd2ebd

Please sign in to comment.