2022-11-28 13:55:05 +08:00
|
|
|
|
//MCCScript 1.0
|
2020-03-22 14:08:25 +08:00
|
|
|
|
|
|
|
|
|
|
string mojangStatus = PerformHttpRequest("https://status.mojang.com/check");
|
|
|
|
|
|
MCC.LogToConsole(mojangStatus);
|
|
|
|
|
|
|
|
|
|
|
|
//MCCScript Extensions
|
|
|
|
|
|
|
2026-03-24 19:48:48 +00:00
|
|
|
|
private static readonly System.Net.Http.HttpClient s_httpClient = new();
|
|
|
|
|
|
|
2020-03-22 14:08:25 +08:00
|
|
|
|
string PerformHttpRequest(string uri)
|
|
|
|
|
|
{
|
2026-03-24 19:48:48 +00:00
|
|
|
|
return s_httpClient.GetStringAsync(uri).GetAwaiter().GetResult();
|
2020-06-07 23:36:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SendHttpPostAsync(string uri, string text)
|
|
|
|
|
|
{
|
|
|
|
|
|
new Thread(() => {
|
2026-03-24 19:44:05 +00:00
|
|
|
|
using var content = new System.Net.Http.StringContent(text, System.Text.Encoding.UTF8, "text/plain");
|
2026-03-24 19:48:48 +00:00
|
|
|
|
using var response = s_httpClient.PostAsync(uri, content).GetAwaiter().GetResult();
|
2026-03-24 19:44:05 +00:00
|
|
|
|
string responseString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
2020-06-07 23:36:56 +02:00
|
|
|
|
//LogToConsole(responseString);
|
|
|
|
|
|
}).Start();
|
2022-11-28 13:55:05 +08:00
|
|
|
|
}
|