using Microsoft.Win32;using System;using System.Diagnostics;using System.IO;using System.Net.Sockets;using System.Threading;using System.Windows.Forms;namespace AfterPatch_SC__Launcher{ public partial class frm_StatusChecker : Form { Thread WorldServerStatusThread; public frm_StatusChecker() { InitializeComponent(); } private void frm_StatusChecker_Load(object sender, EventArgs e) { this.WorldServerStatusThread = new Thread(new ThreadStart(this.WorldServerStatus)); this.WorldServerStatusThread.Start(); } delegate void SetTextCallback(string Text); private void WorldServerStatus() { while ( true ) { try { Thread.Sleep(1000); TcpClient CheckWorldServer = new TcpClient(); CheckWorldServer.Connect("63.251.217.4", 8484); if (this.label_WorldServerStatus.InvokeRequired) { SetTextCallback A1 = new SetTextCallback(SetText); this.Invoke(A1, new object[] { "ONLINE" }); } else { this.label_WorldServerStatus.Text = "ONLINE"; } } catch { if (this.label_WorldServerStatus.InvokeRequired) { SetTextCallback A2 = new SetTextCallback(SetText1); this.Invoke(A2, new object[] { "OFFLINE" }); } else { this.label_WorldServerStatus.Text = "OFFLINE"; } } } } private void SetText(string StatusOnline) { this.label_WorldServerStatus.Text = "ONLINE"; } private void SetText1(string StatusOffline) { this.label_WorldServerStatus.Text = "OFFLINE"; } }}