private async void btnRequestToken_Click(object sender, EventArgs e) { SpartanAuthentication.Token tok; if (txtSpartanToken.Text != "" && cbSkipSTGeneration.Checked) { tok = new SpartanAuthentication.Token { SpartanToken = txtSpartanToken.Text, UserInformation = new SpartanAuthentication.UserInformation { Gamertag = txtGamertag.Text } }; _dot = new AuntieDotManager(tok.SpartanToken, tok.UserInformation.Gamertag); UpdateStatus("Inserted Spartan Token"); return; } tok = await SpartanAuthentication.RequestToken(txtOAuthToken.Text); _dot = new AuntieDotManager(tok.SpartanToken, tok.UserInformation.Gamertag); txtSpartanToken.Text = tok.SpartanToken; txtGamertag.Text = tok.UserInformation.Gamertag; UpdateStatus("Generated Spartan Token"); }
private async void btnDoAuth_Click(object sender, EventArgs e) { var wlidtoken = await WLIDAuthentication.RequestToken(txtEmail.Text, txtPassword.Text); UpdateStatus("WLID OAuth Token Generated"); txtOAuthToken.Text = wlidtoken.AccessToken; var spartanToken = await SpartanAuthentication.RequestToken(wlidtoken.AccessToken); UpdateStatus("Spartan Token Generated"); txtSpartanToken.Text = spartanToken.SpartanToken; _dot = new AuntieDotManager(spartanToken.SpartanToken, spartanToken.UserInformation.Gamertag); UpdateStatus("AuntieDot Initalized"); await _dot.GetServicesListAsync(); lbServices.Items.Clear(); foreach (var service in _dot.ServicesList.ServiceList) { lbServices.Items.Add(service.Value); } UpdateStatus("Services List Recieved"); txtHeaders.Text = string.Format("X-343-Authorization-WLID: v1={0}\r\nX-343-Authorization-Spartan: {1}", wlidtoken.AccessToken, spartanToken.SpartanToken); UpdateStatus("Populated Headers"); }
private async void btnDoAuth_Click(object sender, EventArgs e) { var wlidtoken = await WLIDAuthentication.RequestToken(txtEmail.Text, txtPassword.Text); UpdateStatus("WLID OAuth Token Generated"); txtOAuthToken.Text = wlidtoken.AccessToken; var spartanToken = await SpartanAuthentication.RequestToken(wlidtoken.AccessToken); UpdateStatus("Spartan Token Generated"); txtSpartanToken.Text = spartanToken.SpartanToken; _dot = new AuntieDotManager(spartanToken.SpartanToken, spartanToken.UserInformation.Gamertag); UpdateStatus("AuntieDot Initalized"); await _dot.GetServicesListAsync(); lbServices.Items.Clear(); foreach (var service in _dot.ServicesList.ServiceList) lbServices.Items.Add(service.Value); UpdateStatus("Services List Recieved"); txtHeaders.Text = string.Format("X-343-Authorization-WLID: v1={0}\r\nX-343-Authorization-Spartan: {1}", wlidtoken.AccessToken, spartanToken.SpartanToken); UpdateStatus("Populated Headers"); }
protected void Page_Load(object sender, EventArgs e) { try { var gamertag = Request.QueryString["gt"]; if (gamertag == null || gamertag.Trim() == "") { Response.Redirect("/", false); return; } // Get Player Service Record Dot = new AuntieDotManager("", gamertag); var services = ServicesCache.GetServicesList(); if (services == null) { // nothing in cache, or it has expires. regardless, lets do this services = Dot.CallX343Api(ServicesList.ServicesListUrl); ServicesCache.SetServicesList(services); Dot.SetServicesList(services); } else Dot.GetServicesList(); var playerData = PlayersCache.GetPlayerData(gamertag); if (playerData == null) { // nothing in cache, or it has expires. regardless, lets do this playerData = Dot.CallX343Api(Dot.ServicesList.ServiceList["GetServiceRecord"]); PlayersCache.SetPlayerData(playerData, gamertag); } else playerData = Dot.CallX343Api(Dot.ServicesList.ServiceList["GetServiceRecord"]); ServiceRecordResponse = JsonConvert.DeserializeObject<ServiceRecordResponse>(playerData); if (ServiceRecordResponse.StatusCode != 1) { Response.Redirect("/ServiceRecord/Error/GamertagNotFound", false); return; } // Prep PlayerSpartanImage = Dot.ServicesList.ServiceList["GetSpartanImage"] .Replace("{gamertag}", ServiceRecordResponse.Gamertag) .Replace("{game}", "h4") .Replace("{pose}", "fullbody") .Replace("{size}", "large"); PlayerSpartanEmblem = Dot.CreateUrlFromObject(ServiceRecordResponse.EmblemImageUrl, "120"); PlayerFavWeapon = Dot.CreateUrlFromObject(ServiceRecordResponse.FavoriteWeaponImageUrl, "large"); PlayerCurrentRank = Dot.CreateUrlFromObject(ServiceRecordResponse.RankImageUrl, "large"); if (ServiceRecordResponse.NextRankImageUrl != null) PlayerNextRank = Dot.CreateUrlFromObject(ServiceRecordResponse.NextRankImageUrl, "large"); PlayerCurrentSpecialization = ServiceRecordResponse.Specializations.Single(specialization => specialization.IsCurrent); Title = ServiceRecordResponse.Gamertag + "'s Service Record"; } catch (Exception ex) { Response.Redirect("/ServiceRecord/Error/Exception", false); } }
protected void Page_Load(object sender, EventArgs e) { try { var gamertag = Request.QueryString["gt"]; if (gamertag == null || gamertag.Trim() == "") { Response.Redirect("/", false); return; } // Get Player Service Record Dot = new AuntieDotManager("", gamertag); var services = ServicesCache.GetServicesList(); if (services == null) { // nothing in cache, or it has expires. regardless, lets do this services = Dot.CallX343Api(ServicesList.ServicesListUrl); ServicesCache.SetServicesList(services); Dot.SetServicesList(services); } else { Dot.GetServicesList(); } var playerData = PlayersCache.GetPlayerData(gamertag); if (playerData == null) { // nothing in cache, or it has expires. regardless, lets do this playerData = Dot.CallX343Api(Dot.ServicesList.ServiceList["GetServiceRecord"]); PlayersCache.SetPlayerData(playerData, gamertag); } else { playerData = Dot.CallX343Api(Dot.ServicesList.ServiceList["GetServiceRecord"]); } ServiceRecordResponse = JsonConvert.DeserializeObject <ServiceRecordResponse>(playerData); if (ServiceRecordResponse.StatusCode != 1) { Response.Redirect("/ServiceRecord/Error/GamertagNotFound", false); return; } // Prep PlayerSpartanImage = Dot.ServicesList.ServiceList["GetSpartanImage"] .Replace("{gamertag}", ServiceRecordResponse.Gamertag) .Replace("{game}", "h4") .Replace("{pose}", "fullbody") .Replace("{size}", "large"); PlayerSpartanEmblem = Dot.CreateUrlFromObject(ServiceRecordResponse.EmblemImageUrl, "120"); PlayerFavWeapon = Dot.CreateUrlFromObject(ServiceRecordResponse.FavoriteWeaponImageUrl, "large"); PlayerCurrentRank = Dot.CreateUrlFromObject(ServiceRecordResponse.RankImageUrl, "large"); if (ServiceRecordResponse.NextRankImageUrl != null) { PlayerNextRank = Dot.CreateUrlFromObject(ServiceRecordResponse.NextRankImageUrl, "large"); } PlayerCurrentSpecialization = ServiceRecordResponse.Specializations.Single(specialization => specialization.IsCurrent); Title = ServiceRecordResponse.Gamertag + "'s Service Record"; } catch (Exception ex) { Response.Redirect("/ServiceRecord/Error/Exception", false); } }