public UserControlAuthenticationTester()
 {
     InitializeComponent();
     AuthForm            = new AuthenticationForm();
     AuthenticationForms = new List <AuthenticationForm>();
     authTester          = new AuthenticationTester();
     LoadTestFiles();
     AwaitingFinish       = false;
     LastCombinationIndex = 0;
 }
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (AwaitingFinish)
            {
                authTester.Stop();
                buttonStart.Enabled = false;
            }
            else
            {
                if (!VerifyInputStart())
                {
                    return;
                }

                listViewAuths.Items.Clear();
                buttonSelectFields.Enabled = false;
                textBoxURL.ReadOnly        = true;
                buttonStart.Text           = "Stop";
                AwaitingFinish             = true;
                LastCombinationIndex       = 0;

                authTester           = new AuthenticationTester();
                authTester.URL       = textBoxURL.Text;
                authTester.AuthForm  = AuthForm;
                authTester.Usernames = new List <string>(File.ReadAllLines(textBoxUsernameFile.Text));
                authTester.Passwords = new List <string>(File.ReadAllLines(textBoxPasswordFile.Text));
                toolStripProgressBarAuthTester.Maximum = authTester.Usernames.Count * authTester.Passwords.Count;

                authTester.SuccessFilter.Text = textBoxCondition.Text;
                if (comboBoxCondition.SelectedIndex == 0)
                {
                    authTester.SuccessFilter.Condition = Filter.Conditions.StatusCodeIs;
                }
                else if (comboBoxCondition.SelectedIndex == 1)
                {
                    authTester.SuccessFilter.Condition = Filter.Conditions.StatusCodeIsNot;
                }
                else if (comboBoxCondition.SelectedIndex == 2)
                {
                    authTester.SuccessFilter.Condition = Filter.Conditions.HTMLContains;
                }
                else if (comboBoxCondition.SelectedIndex == 3)
                {
                    authTester.SuccessFilter.Condition = Filter.Conditions.HTMLContainsNot;
                }
                else if (comboBoxCondition.SelectedIndex == 4)
                {
                    authTester.SuccessFilter.Condition = Filter.Conditions.RegularExpression;
                }

                if (comboBoxAuthMethod.SelectedIndex == 0)
                {
                    authTester.Authentication = AuthenticationTester.AuthenticationMethods.BasicAuth;
                }
                else
                {
                    authTester.Authentication = AuthenticationTester.AuthenticationMethods.HTMLForm;
                }

                authTester.Start();
            }
        }