|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using Newtonsoft.Json;
- using Example.Models;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Net.Http;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace Example.Connectors
- {
- internal class SendTaxi
- {
- public static async Task<PackOrderStatus> TaxiOrderProcess(string serverPort, string steamdi, string taxiname)
- {
- try
- {
- string apiurl = $"https://api.whalleybot.com/bot/{serverPort}/BuyTaxi/{steamdi}/{taxiname}";
- var handler = new HttpClientHandler()
- {
- ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
- };
-
- using (var client = new HttpClient(handler))
- {
- client.DefaultRequestHeaders.Add("Authorization", "WhalleyBotOverlay_e-H1rr55f");
- client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
-
- var response = await client.GetAsync(apiurl)
- .ConfigureAwait(false);
- if (response.IsSuccessStatusCode)
- {
- var json = response.Content.ReadAsStringAsync().Result;
- //Console.WriteLine(json);
- PackOrderStatus Infoserver = JsonConvert.DeserializeObject<PackOrderStatus>(json);
-
- return Infoserver;
- }
- else
- {
- throw new Exception(response.ReasonPhrase + response.StatusCode + response.RequestMessage);
- }
-
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Source + ex.Message + ex.Data + ex.StackTrace);
- return null;
- }
- }
- }
- }
|