Exemple #1
0
        private IDictionary <string, string> ProcessSendHeaders()
        {
            int Row = 1;
            IDictionary <string, string> SendHeaders = new Dictionary <string, string>()
            {
            };

            foreach (Control item in gbHeaders.Controls)
            {
                if (item is TextBox && item.Name.IndexOf("txtHeaderN") > -1)
                {
                    if (WinFun.FindControl(gbHeaders, "txtHeaderN" + Row.ToString()) is TextBox CtTbKey && CtTbKey.Text.Trim().Length > 0 &&
                        WinFun.FindControl(gbHeaders, "txtHeaderV" + Row.ToString()) is TextBox CtTbValue && CtTbValue.Text.Trim().Length > 0)
                    {
                        SendHeaders.Add(CtTbKey.Text.Trim(), CtTbValue.Text.Trim());
                    }
                    Row++;
                }
            }
            if (txtUserAgent.Text.Trim().Length > 0)
            {
                SendHeaders.Add("User-Agent", txtUserAgent.Text.Trim());
            }

            return(SendHeaders);
        }
Exemple #2
0
        private void btnHtppSend_Click(object sender, EventArgs e)
        {
            _Thread_WebGetting = new Thread(() =>
            {
                btnHtppSend.Enabled = false;

                #region Parameters/Headers
                IDictionary <string, string> SendParams = new Dictionary <string, string>()
                {
                };
                IDictionary <string, string> SendHeaders = ProcessSendHeaders();

                int Row = 1;
                foreach (Control item in gbParameters.Controls)
                {
                    if (item is TextBox && item.Name.IndexOf("txtParamN") > -1)
                    {
                        if (WinFun.FindControl(gbParameters, "txtParamN" + Row.ToString()) is TextBox CtTbKey && CtTbKey.Text.Trim().Length > 0 &&
                            WinFun.FindControl(gbParameters, "txtParamV" + Row.ToString()) is TextBox CtTbValue && CtTbValue.Text.Trim().Length > 0)
                        {
                            SendParams.Add(CtTbKey.Text.Trim(), CtTbValue.Text.Trim());
                        }
                        Row++;
                    }
                }
                #endregion

                #region Process & Results
                switch (cmbAPIAction.SelectedIndex)
                {
                case (int)APIActionType.GetVerifyCode: picVerifyCode_Click(new object(), new EventArgs()); break;

                case (int)APIActionType.GetSMS: btnGetLoginSMS_Click(new object(), new EventArgs()); break;

                case (int)APIActionType.UserLogin: btnUserLogin_Click(new object(), new EventArgs()); break;

                case (int)APIActionType.UserRegister: btnGetRegisterSMS_Click(new object(), new EventArgs()); break;

                default:
                    ProcessHTTPSend(GetHTTPSendURL(cmbAPIAction.SelectedIndex), SendParams, SendHeaders, out string OutMessages, out string OutHtmlSource);
                    break;
                }
                #endregion

                btnHtppSend.Enabled = true;
            });
            _Thread_WebGetting.Start();
        }