private void LoginThreadTimer_Tick(object sender, EventArgs e)
        {
            LoginThreadTimer.Stop();

            string password = "";
            string username = "";
            password = Security.md5(textBox2.Text);
            developerOutput.AppendText("[INFO]Encrypt -> " + password + Environment.NewLine);
            username = textBox1.Text;
            ConnectionManager CM = new ConnectionManager("vbproject.redirectme.net");
            int ResponseCode = -1;
            bool errorNow = false;
            if(username.Contains(";")) {
                errorNow = true;
                ResponseCode = ErrorHandler.ERROR_INVALID_CHARACTERS;
            }
            if(!errorNow) {
                if (ACTION_REGISTER)
                {
                    ResponseCode = CM.sendSignal("command=regauth;username="******";password="******"Password";
                        ACTION_REGISTER = false;
                    }
                    else
                    {
                        ShowError(ResponseCode);
                    }
                }
                else
                {
                    ResponseCode = CM.sendSignal("command=auth;username="******";password="******"LOGIN OK" + Environment.NewLine);
                        errorPanel.BackColor = Color.FromArgb(0, 0, 255, 0);
                        ShowError(100);
                        authenticationPanel.Hide();
                        MainGameForm MGF = new MainGameForm(username, password, this);
                        MGF.FormClosing += new FormClosingEventHandler(ExitMainGame);
                        MGF.TopMost = true;
                        MGF.ShowDialog();
                        label3.Text = "";
                    }
                    else if (ResponseCode == ErrorHandler.NOERROR_REGISTRATION_VALIDATION)
                    {
                        label2.Text = "Registration Code (from validation email)";
                        textBox2.Text = "";
                        textBox1.Enabled = false;
                        ShowError(ResponseCode);
                        ACTION_REGISTER = true;
                    }
                    else
                        ShowError(ResponseCode);
                }
            }
            authenticationPanel.Cursor = clientCursors.CreateCursor(Properties.Resources.CursorImage, 0, 0);
            pictureBox1.Enabled = true;
            pictureBox5.Enabled = true;
            textBox1.Enabled = true;
            textBox2.Enabled = true;
        }
Exemple #2
0
        private void LoginThreadTimer_Tick(object sender, EventArgs e)
        {
            LoginThreadTimer.Stop();

            string password = "";
            string username = "";

            password = Security.md5(textBox2.Text);
            developerOutput.AppendText("[INFO]Encrypt -> " + password + Environment.NewLine);
            username = textBox1.Text;
            ConnectionManager CM = new ConnectionManager("vbproject.redirectme.net");
            int  ResponseCode    = -1;
            bool errorNow        = false;

            if (username.Contains(";"))
            {
                errorNow     = true;
                ResponseCode = ErrorHandler.ERROR_INVALID_CHARACTERS;
            }
            if (!errorNow)
            {
                if (ACTION_REGISTER)
                {
                    ResponseCode = CM.sendSignal("command=regauth;username="******";password="******"Password";
                        ACTION_REGISTER = false;
                    }
                    else
                    {
                        ShowError(ResponseCode);
                    }
                }
                else
                {
                    ResponseCode = CM.sendSignal("command=auth;username="******";password="******"LOGIN OK" + Environment.NewLine);
                        errorPanel.BackColor = Color.FromArgb(0, 0, 255, 0);
                        ShowError(100);
                        authenticationPanel.Hide();
                        MainGameForm MGF = new MainGameForm(username, password, this);
                        MGF.FormClosing += new FormClosingEventHandler(ExitMainGame);
                        MGF.TopMost      = true;
                        MGF.ShowDialog();
                        label3.Text = "";
                    }
                    else if (ResponseCode == ErrorHandler.NOERROR_REGISTRATION_VALIDATION)
                    {
                        label2.Text      = "Registration Code (from validation email)";
                        textBox2.Text    = "";
                        textBox1.Enabled = false;
                        ShowError(ResponseCode);
                        ACTION_REGISTER = true;
                    }
                    else
                    {
                        ShowError(ResponseCode);
                    }
                }
            }
            authenticationPanel.Cursor = clientCursors.CreateCursor(Properties.Resources.CursorImage, 0, 0);
            pictureBox1.Enabled        = true;
            pictureBox5.Enabled        = true;
            textBox1.Enabled           = true;
            textBox2.Enabled           = true;
        }