Exemplo n.º 1
0
        /// <summary>
        /// Launch the Minecraft Client by clicking the "Go!" button.
        /// If a client is already running, it will be closed.
        /// </summary>

        private void btn_connect_Click(object sender, EventArgs e)
        {
            if (Client != null)
            {
                Client.Close();
                t_clientread.Abort();
                box_output.Text = "";
            }

            // 2019-10-26 機能追加に伴い、ラジオボタンどちらの値も変数に格納するよう分岐を実装
            string username = "";
            string password = "";
            string serverip = "";

            if (radio_1.Checked)
            {
                username = box_Login.Text;
                password = box_password.Text;
                serverip = box_ip.Text;
            }
            else if (radio_2.Checked)
            {
                if (tmpLoginStr == "" || tmpPassStr == "")
                {
                    MessageBox.Show("アカウントを選択してください");
                }
                username = tmpLoginStr;
                password = tmpPassStr;
            }

            if (box_ip.Visible && box_ip.Text != "")
            {
                serverip = box_ip.Text;
            }
            else if (sel_ip.Visible && sel_ip.Text != "")
            {
                serverip = sel_ip.Text;
            }

            if (password == "")
            {
                password = "******";
            }
            if (username != "" && serverip != "")
            {
                initClient(new MinecraftClient(username, password, serverip));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Launch the Minecraft Client by clicking the "Go!" button.
        /// If a client is already running, it will be closed.
        /// </summary>

        private void btn_connect_Click(object sender, EventArgs e)
        {
            if (Client != null)
            {
                Client.Close();
                t_clientread.Abort();
                box_output.Text = "";
            }
            string username = box_Login.Text;
            string password = box_password.Text;
            string serverip = box_ip.Text;

            if (password == "")
            {
                password = "******";
            }
            if (username != "" && serverip != "")
            {
                initClient(new MinecraftClient(username, password, serverip));
            }
        }