コード例 #1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            rcon cs = new rcon();

            this.lblHostname.Text = "";
            this.lblMaps.Text     = "";
            this.lblPlayers.Text  = "";
            this.lblVersion.Text  = "";


            string serverResponse = cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "status").Replace("\n", "\r\n");

            this.lblHostname.Text = getBetween(serverResponse, "hostname: ", "version");
            this.lblMaps.Text     = getBetween(serverResponse, "map     :  ", " at:");
            this.lblPlayers.Text  = (getBetween(serverResponse, "players : ", "active") + "/" + (getBetween(serverResponse, "active (", " max)")));
            this.lblVersion.Text  = getBetween(serverResponse, "version : ", "tcp/ip  :  ");
            string mapName = getBetween(serverResponse, "map     :  ", " at:");

            this.mapImgBox.SizeMode = PictureBoxSizeMode.StretchImage;
            if (!File.Exists(@"maps\" + mapName + ".jpg"))
            {
                this.mapImgBox.Image = Image.FromFile(@"maps\noimage.jpg");
            }
            else
            {
                this.mapImgBox.Image = Image.FromFile(@"maps\" + mapName + ".jpg");
            }
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            rcon cs = new rcon();

            this.txtResponse.Text = "";

            string serverResponse = cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "kick #" + this.txtKickID.Text).Replace("\n", "\r\n");

            this.txtResponse.Text = serverResponse.Remove(0, 5);
        }
コード例 #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            rcon cs = new rcon();

            this.txtResponse.Text = "";

            string serverResponse = cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "pausable 0").Replace("\n", "\r\n");

            Thread.Sleep(1000);
            serverResponse        = cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "unpause").Replace("\n", "\r\n");
            this.txtResponse.Text = serverResponse.Remove(0, 5);
        }
コード例 #4
0
        private void button17_Click(object sender, EventArgs e)
        {
            string knife = "say \"================================== [Knife Round] \"";

            rcon cs = new rcon();

            this.txtResponse.Text = "";

            string serverResponse = cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, knife).Replace("\n", "\r\n");

            this.txtResponse.Text = "SERVER: ================================== [Knife Round]";
        }
コード例 #5
0
        private void button16_Click(object sender, EventArgs e)
        {
            string liveOn3 = "sv_restart \"1\" ;";

            rcon cs = new rcon();

            this.txtResponse.Text = "";

            string serverResponse = cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, liveOn3).Replace("\n", "\r\n");

            this.txtResponse.Text = "Server: sv_restart 1";
        }
コード例 #6
0
        private void button18_Click(object sender, EventArgs e)
        {
            rcon cs = new rcon();

            this.txtResponse.Text = "";

            cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "mp_startmoney \"16000\"").Replace("\n", "\r\n");
            Thread.Sleep(1000);
            cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "mp_roundtime \"10\"").Replace("\n", "\r\n");
            Thread.Sleep(1000);
            cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "mp_freezetime  \"0\"").Replace("\n", "\r\n");
            Thread.Sleep(1000);
            cs.sendRCON(this.txtServerIP.Text, int.Parse(this.txtServerPort.Text), this.txtPassword.Text, "sv_restart   \"1\"").Replace("\n", "\r\n");



            this.txtResponse.Text = "SERVER: Startmoney = 16000\r\nSERVER: Roundtime = 10\r\nSERVER: Freezetime = 0";
        }