public void returnBlueprint(string printName, string printData) { var options = Options.Current; if (options.rconplayer != null) { var rcon = new Rcon(); var rconhost = new System.Net.IPEndPoint( System.Net.Dns.GetHostEntry(options.rconhost).AddressList[0], options.rconport); const string rconcommand = "/c remote.call('foreman','addBlueprint',game.players['{0}'],{1},{2})"; Console.WriteLine("Sending {0} to Foreman by RCON...", printName); rcon.ConnectBlocking(rconhost, options.rconpass); rcon.ServerCommandBlocking( string.Format(rconcommand, options.rconplayer, Compress(printData), printName)); rcon.Disconnect(); } else { Console.WriteLine(printName); //Console.WriteLine(printData); Console.WriteLine(Compress(printData)); Console.WriteLine(""); } }
private void Disconnect_Click(object sender, EventArgs e) { //MessageBox.Show("You have been disconnected, but as we do not support reconnect please reopen the program."); sr.Disconnect(); playerBackGround.CancelAsync(); ConnectButton.Text = "Connect"; ConnectButton.Click += button2_Click; ConnectButton.Click -= Disconnect_Click; }
private void Disconnect_Click(object sender, EventArgs e) { //MessageBox.Show("You have been disconnected, but as we do not support reconnect please reopen the program."); sr.Disconnect(); playerBackGround.CancelAsync(); string whitespace = (Environment.NewLine); string message = ("You are attempting to disconnect."); MethodInvoker m = () => { internalLog.AppendText(message); }; MethodInvoker w = () => { internalLog.AppendText(whitespace); }; MethodInvoker r = () => { internalLog.AppendText("Disconnect Successfull."); }; this.Invoke(w); this.Invoke(m); this.Invoke(w); this.Invoke(r); this.Invoke(w); ConnectButton.Text = "Connect"; ConnectButton.Click += button2_Click; ConnectButton.Click -= Disconnect_Click; }