private void DownloadCompleted_StupidData(object sender, DownloadStringCompletedEventArgs e) { EnableAll(); ProgressDone(); Match m1 = Regex.Match(e.Result, "id=\"__VIEWSTATE\" value=\"(.*)\" />", RegexOptions.None); Match m2 = Regex.Match(e.Result, "id=\"__EVENTVALIDATION\" value=\"(.*)\" />", RegexOptions.None); if (m1.Success) { ViewState = m1.Groups[1].Value; } else { Log("ERROR: Couldn't find view state string!"); } if (m2.Success) { EventValidation = m2.Groups[1].Value; } else { Log("ERROR: Couldn't find event validation string!"); } Status("Attempting to sign into DDI..."); string postdata = "__VIEWSTATE=" + HttpUtility.UrlEncode(ViewState) + "&__EVENTVALIDATION=" + HttpUtility.UrlEncode(EventValidation) + "&email=" + HttpUtility.UrlEncode(tbEmail.Text) + "&password="******"&InsiderSignin=Sign+In"; DisableAll(); CustomWebClient client = new CustomWebClient(); client.UploadStringCompleted += new UploadStringCompletedEventHandler(UploadCompleted_SignIn); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged); client.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); client.UploadStringAsync(new Uri(URL_LOGIN), "POST", postdata); }
private void btnMonsters_RetrieveList_Click(object sender, RoutedEventArgs e) { Status("Retrieving monster list from DDI Compendium..."); DisableAll(); CustomWebClient client = new CustomWebClient(); client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged); client.DownloadFileAsync(new Uri(URL_LIST_MONSTER), Directory.GetCurrentDirectory() + "\\monster_list.xml"); }
private void UpdateStupidData() { Status("Obtaining view state and event validation strings from DDI..."); DisableAll(); CustomWebClient client = new CustomWebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadCompleted_StupidData); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged); client.DownloadStringAsync(new Uri(URL_LOGIN)); }
private void DownloadCompleted_StupidData(object sender, DownloadStringCompletedEventArgs e) { EnableAll(); ProgressDone(); Match m1 = Regex.Match(e.Result, "id=\"__VIEWSTATE\" value=\"(.*)\" />", RegexOptions.None); Match m2 = Regex.Match(e.Result, "id=\"__EVENTVALIDATION\" value=\"(.*)\" />", RegexOptions.None); if (m1.Success) { ViewState = m1.Groups[1].Value; } else Log("ERROR: Couldn't find view state string!"); if (m2.Success) { EventValidation = m2.Groups[1].Value; } else Log("ERROR: Couldn't find event validation string!"); Status("Attempting to sign into DDI..."); string postdata = "__VIEWSTATE=" + HttpUtility.UrlEncode(ViewState) + "&__EVENTVALIDATION=" + HttpUtility.UrlEncode(EventValidation) + "&email=" + HttpUtility.UrlEncode(tbEmail.Text) + "&password="******"&InsiderSignin=Sign+In"; DisableAll(); CustomWebClient client = new CustomWebClient(); client.UploadStringCompleted += new UploadStringCompletedEventHandler(UploadCompleted_SignIn); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged); client.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); client.UploadStringAsync(new Uri(URL_LOGIN), "POST", postdata); }