Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Lethal Extended Beta v1.0.5
plugins/GrafanaPostMod.dll
Decompiled 2 months agousing System; using System.Collections; using System.Diagnostics; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GrafanaPostMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e3620948c42bf257930c66e18053ead38be3c7a7")] [assembly: AssemblyProduct("GrafanaPostMod")] [assembly: AssemblyTitle("GrafanaPostMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GrafanaPostMod { [BepInPlugin("com.pengucc.grafanapostmod", "Grafana Post Mod", "1.0.0")] public class GrafanaPostMod : BaseUnityPlugin { private static readonly HttpClient httpClient = new HttpClient(); private float postRequestInterval = 15f; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Grafana Post Mod is initializing..."); ((MonoBehaviour)this).StartCoroutine(PostRequestCoroutine()); } private IEnumerator PostRequestCoroutine() { while (true) { yield return (object)new WaitForSeconds(postRequestInterval); Task.Run(async delegate { await SendPostRequest(); }); } } private async Task SendPostRequest() { try { string url = "https://lestats.lethal-extended.com/api/leplayers"; int playerCount = 1; string jsonData = $"{{ \"player_count\": {playerCount} }}"; StringContent content = new StringContent(jsonData, Encoding.UTF8, "application/json"); HttpResponseMessage response = await httpClient.PostAsync(url, content); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Successfully sent POST request. Response: " + responseBody)); } catch (Exception ex2) { Exception ex = ex2; ((BaseUnityPlugin)this).Logger.LogError((object)("Error sending POST request: " + ex.Message)); } } } }