コード例 #1
0
        private void btnConnectRCon_Click(object sender, EventArgs e)
        {
            IPAddress ip   = IPAddress.Parse("127.0.0.1");
            int       port = 12345;

            IPEndPoint ipe = new IPEndPoint(ip, port);

            sr = new Rcon();
            sr.ConnectionSuccess += new BoolInfo(sr_ConnectionSuccess);
            sr.ServerOutput      += new RconOutput(sr_ServerOutput);
            sr.Errors            += new RconOutput(sr_Errors);

            sr.Connect(ipe, "12345");
            while (!sr.Connected)
            {
                Thread.Sleep(10);
            }
            sr.ServerCommand("/p");
            sr.ServerCommand("/p");
            //playerBackGround.RunWorkerAsync();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: qbasic16/Factorio-RCON
        private void button2_Click(object sender, EventArgs e)
        {
            IPAddress ip   = IPAddress.Parse(IPBox.Text);
            int       port = int.Parse(PortBox.Text);

            IPEndPoint ipe = new IPEndPoint(ip, port);

            sr = new Rcon();
            sr.ConnectionSuccess += new BoolInfo(sr_ConnectionSuccess);
            sr.ServerOutput      += new RconOutput(sr_ServerOutput);
            sr.Errors            += new RconOutput(sr_Errors);

            sr.Connect(ipe, PasswordBox.Text);
            while (!sr.Connected)
            {
                Thread.Sleep(10);
            }
            sr.ServerCommand(Properties.Settings.Default.Players);
            sr.ServerCommand(Properties.Settings.Default.Players);
            playerBackGround.RunWorkerAsync();
            //PlayerJob();
            // Thread playerThread = new Thread(PlayerJob);
            //  playerThread.Start();
        }