コード例 #1
0
        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("");
            }
        }
コード例 #2
0
        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;
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: qbasic16/Factorio-RCON
        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;
        }