private async Task ExtractGameDataAsync() { var clientUrlRequest = (HttpWebRequest)WebRequest.Create($"{_hotelUri.OriginalString}/api/client/clienturl"); clientUrlRequest.ContentType = "application/json;charset=UTF-8"; clientUrlRequest.CookieContainer = Cookies; clientUrlRequest.AllowAutoRedirect = false; clientUrlRequest.Method = "GET"; clientUrlRequest.Proxy = null; using (WebResponse clientUrlResponse = await clientUrlRequest.GetResponseAsync().ConfigureAwait(false)) using (Stream clientUrlStream = clientUrlResponse.GetResponseStream()) using (var clientUrlReader = new StreamReader(clientUrlStream)) { string clientUrl = await clientUrlReader.ReadToEndAsync(); clientUrl = clientUrl.GetChild("{\"clienturl\":\"", '"'); using (var client = new WebClient()) { client.Proxy = null; client.Headers["Cookie"] = clientUrlRequest.Headers["Cookie"]; SsoTicket = clientUrl.Split('/').Last(); string clientBody = await client.DownloadStringTaskAsync(clientUrl); GameData = new HGameData(clientBody); } } }
public async Task <HGameData> GetGameDataAsync() { string body = await Requester.DownloadStringAsync( _hotelUri.OriginalString + "/api/client/clienturl").ConfigureAwait(false); body = body.GetChild("{\"clienturl\":\"", '"'); SsoTicket = body.Split('/').Last(); body = await Requester.DownloadStringAsync(body) .ConfigureAwait(false); return(GameData = new HGameData(body)); }
public async Task<HGameData> GetGameDataAsync() { string body = await Requester.DownloadStringAsync( _hotelUri.OriginalString + "/api/client/clienturl").ConfigureAwait(false); body = body.GetChild("{\"clienturl\":\"", '"'); SsoTicket = body.Split('/').Last(); body = await Requester.DownloadStringAsync(body) .ConfigureAwait(false); return (GameData = new HGameData(body)); }