57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: CountryLocation
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
using Raton.Classes;
|
|
using RatonBack;
|
|
using System;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
#nullable disable
|
|
public static class CountryLocation
|
|
{
|
|
private static readonly HttpClient http = new HttpClient()
|
|
{
|
|
Timeout = TimeSpan.FromSeconds(5.0)
|
|
};
|
|
|
|
private static async void clientInformation()
|
|
{
|
|
try
|
|
{
|
|
int num = await BackendClient.ValidateSessionFlags(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId()) ? 1 : 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
int num = (int) MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
|
|
Environment.Exit(0);
|
|
}
|
|
}
|
|
|
|
public static async Task<(double Lat, double Lon)?> GetCapitalCoordinatesAsync(string countryName)
|
|
{
|
|
try
|
|
{
|
|
string requestUri = "https://restcountries.com/v3.1/name/" + Uri.EscapeDataString(countryName);
|
|
JArray jarray = JArray.Parse(await CountryLocation.http.GetStringAsync(requestUri));
|
|
if (jarray.Count > 0)
|
|
{
|
|
JToken jtoken = jarray[0][(object) "capitalInfo"];
|
|
if (jtoken?[(object) "latlng"] != null)
|
|
return new (double, double)?(((double) jtoken[(object) "latlng"][(object) 0], (double) jtoken[(object) "latlng"][(object) 1]));
|
|
CountryLocation.clientInformation();
|
|
}
|
|
CountryLocation.clientInformation();
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
return new (double, double)?();
|
|
}
|
|
}
|