mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/9bf31c0e-e47b-4654-be10-6ea50f27a581
23 lines
769 B
C#
23 lines
769 B
C#
//MCCScript 1.0
|
|
|
|
string mojangStatus = PerformHttpRequest("https://status.mojang.com/check");
|
|
MCC.LogToConsole(mojangStatus);
|
|
|
|
//MCCScript Extensions
|
|
|
|
private static readonly System.Net.Http.HttpClient s_httpClient = new();
|
|
|
|
string PerformHttpRequest(string uri)
|
|
{
|
|
return s_httpClient.GetStringAsync(uri).GetAwaiter().GetResult();
|
|
}
|
|
|
|
void SendHttpPostAsync(string uri, string text)
|
|
{
|
|
new Thread(() => {
|
|
using var content = new System.Net.Http.StringContent(text, System.Text.Encoding.UTF8, "text/plain");
|
|
using var response = s_httpClient.PostAsync(uri, content).GetAwaiter().GetResult();
|
|
string responseString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
|
//LogToConsole(responseString);
|
|
}).Start();
|
|
}
|