예제 #1
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            LoginBtn.Enabled     = false;
            LoginTimeOut.Enabled = true;
            if (!_connection.IsConnected)
            {
                if (!Program.ServerConnection.Connect(Program.Config.ServerAddress, Program.Config.ServerPort))
                {
                    MessageBox.Show(Program.LanguageManager.Translation.pMsbErrorToServer);
                    ResetTimeOut();
                    return;
                }
            }
            if (UsernameInput.Text == "")
            {
                MessageBox.Show(Program.LanguageManager.Translation.LoginMsb2);
                return;
            }
            if (PasswordInput.Text == "")
            {
                MessageBox.Show(Program.LanguageManager.Translation.LoginMsb3);
                return;
            }

            _authenticator.Authenticate(UsernameInput.Text, LauncherHelper.EncodePassword(PasswordInput.Text));
            if (AutoLoginCheckBox.Checked)
            {
                _configuration.DefaultUsername = UsernameInput.Text;
                _configuration.Password        = LauncherHelper.EncodePassword(PasswordInput.Text);
                _configuration.AutoLogin       = AutoLoginCheckBox.Checked;
                _configuration.Save(Program.ConfigurationFilename);
            }
        }
예제 #2
0
 private void RegisterBtn_Click(object sender, EventArgs e)
 {
     if (ConfirmInput.Text != PasswordInput.Text)
     {
         MessageBox.Show("Confirm password is wrong.");
         return;
     }
     if (ConfirmInput.Text == "")
     {
         MessageBox.Show(Program.LanguageManager.Translation.RegistMsb1);
         return;
     }
     if (PasswordInput.Text == "")
     {
         MessageBox.Show(Program.LanguageManager.Translation.RegistMsb2);
         return;
     }
     if (UsernameInput.Text == "")
     {
         MessageBox.Show(Program.LanguageManager.Translation.RegistMsb3);
         return;
     }
     Program.ServerConnection.SendPacket("REGISTER||" + UsernameInput.Text + "||" + LauncherHelper.EncodePassword(PasswordInput.Text) + "||" + LauncherHelper.GetUID());
 }