public DialogResult ShowDialog(out CaptchaSolution solution)
        {
            var result = this.ShowDialog();

            solution = this.Solution;
            return(result);
        }
Exemplo n.º 2
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            var resps        = geckoWebBrowser1.Document.GetElementsByName("g-recaptcha-response");
            var solutionText = string.Empty;

            foreach (var resp in resps)
            {
                var textArea    = resp as Gecko.DOM.GeckoTextAreaElement;
                var captchaText = textArea?.Value ?? "";
                if (string.IsNullOrEmpty(captchaText))
                {
                    continue;
                }

                solutionText += $"{captchaText}\n\n";
            }

            var captchagid = (geckoWebBrowser1.Document.GetElementById("captchagid")
                              ?? geckoWebBrowser1.Document.GetElementsByName("captchagid")?.FirstOrDefault(x => x != null))
                             as Gecko.DOM.GeckoInputElement;

            Solution = new CaptchaSolution(solutionText, captchagid?.Value, Configuration.Captcha);

            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 3
0
    public void PostCaptchaSolution(CaptchaType type, CaptchaSolution solution)
    {
        APICall <PostCaptchaSolutionOperation> aPICall = clubPenguinClient.CaptchaApi.PostCaptchaSolution(type, solution);

        aPICall.OnResponse += onPostCaptchaSolutionSuccess;
        aPICall.OnError    += onPostCaptchaSolutionFailed;
        aPICall.Execute();
    }
Exemplo n.º 4
0
        public DialogResult ShowDialog(out CaptchaSolution solution)
        {
            btnReload_Click(null, null);

            var result = this.ShowDialog();

            solution = this.Solution;
            return(result);
        }
 private void CaptchaDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (e.CloseReason == CloseReason.UserClosing &&
         DialogResult != DialogResult.OK)
     {
         Solution     = new CaptchaSolution(false, "You closed captcha dialog box.", Config.Captcha);
         DialogResult = DialogResult.Cancel;
     }
 }
    private IEnumerator showLoadingSpinnerDelay(CaptchaSolution solution)
    {
        yield return(new WaitForFrame(5));

        setLoadingSpinnerVisibility(show: true);
        for (int i = 0; i < imageToggles.Length; i++)
        {
            imageToggles[i].Toggle.isOn = false;
        }
        Service.Get <INetworkServicesManager>().CaptchaService.PostCaptchaSolution(captchaType, solution);
    }
 private void LoadCaptcha()
 {
     if (Config.Captcha.Enabled)
     {
         Logger.Debug("Solving captcha using services...");
         Solution = _httpHandler.SolveCaptcha(UpdateStatus, Config);
     }
     else
     {
         Logger.Debug("Solving captcha using dialog box...");
         DrawCaptcha();
     }
 }
        public CaptchaDialog(HttpHandler httpHandler, Action <string> updateStatus, Models.Configuration config)
        {
            Logger.Debug("Init. solving captcha...");

            Solution = new CaptchaSolution(false, "Something went wrong...", config.Captcha);

            _httpHandler = httpHandler;

            InitializeComponent();

            Config       = config;
            UpdateStatus = updateStatus;

            LoadCaptcha();
        }
    private void onToggleOnClickedPosition(string toggleId, bool isToggleOn, Vector2 toggleClickPosition)
    {
        if (!isToggleOn)
        {
            int num = 0;
            SelectedImageInfo item;
            while (true)
            {
                if (num < selectedImagesList.Count)
                {
                    item = selectedImagesList[num];
                    if (item.ToggleId == toggleId)
                    {
                        break;
                    }
                    num++;
                    continue;
                }
                return;
            }
            selectedImagesList.Remove(item);
            return;
        }
        RectTransformUtility.ScreenPointToLocalPointInRectangle(CaptchaImageRectTransform, toggleClickPosition, guiCamera, out Vector2 localPoint);
        SelectedImageInfo item2 = default(SelectedImageInfo);

        item2.ToggleId           = toggleId;
        item2.ImageLocalPosition = localPoint;
        selectedImagesList.Add(item2);
        if (selectedImagesList.Count == captchaData.solutionSize)
        {
            CaptchaSolution captchaSolution = new CaptchaSolution();
            captchaSolution.id = captchaId;
            captchaSolution.captchaDimensions = captchaData.captchaDimensions;
            List <SolutionPoint> list = new List <SolutionPoint>();
            for (int num = 0; num < selectedImagesList.Count; num++)
            {
                SolutionPoint solutionPoint = new SolutionPoint();
                solutionPoint.x = (int)selectedImagesList[num].ImageLocalPosition.x;
                solutionPoint.y = (int)selectedImagesList[num].ImageLocalPosition.y;
                list.Add(solutionPoint);
            }
            captchaSolution.solution = list;
            CoroutineRunner.Start(showLoadingSpinnerDelay(captchaSolution), this, "showLoadingSpinnerDelay");
        }
    }
Exemplo n.º 10
0
        public ReCaptchaDialog(Models.Configuration configuration, Models.ProxyItem proxy)
        {
            Configuration = configuration;
            Solution      = new CaptchaSolution(false, Solution.Message, configuration.Captcha);
            InitializeComponent();

            if ((proxy?.Enabled ?? false))
            {
                GeckoPreferences.Default["network.proxy.type"] = 1;

                // clear proxies
                GeckoSetProxy(Enums.ProxyType.Http, "", 0);
                GeckoSetProxy(Enums.ProxyType.Socks4, "", 0);

                GeckoSetProxy(proxy.ProxyType, proxy.Host, proxy.Port);
            }
            else
            {
                GeckoPreferences.Default["network.proxy.type"] = 0;
            }
        }
Exemplo n.º 11
0
 public PostCaptchaSolutionOperation(CaptchaType type, CaptchaSolution captchaSolution)
 {
     Type            = type;
     CaptchaSolution = captchaSolution;
 }
Exemplo n.º 12
0
        public APICall <PostCaptchaSolutionOperation> PostCaptchaSolution(CaptchaType type, CaptchaSolution captchaSolution)
        {
            PostCaptchaSolutionOperation operation = new PostCaptchaSolutionOperation(type, captchaSolution);

            return(new APICall <PostCaptchaSolutionOperation>(clubPenguinClient, operation));
        }
Exemplo n.º 13
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.Cancel;
     Solution     = new CaptchaSolution(false, "Closed captcha dialog.", Configuration.Captcha);
     Close();
 }
 private void BtnConfirm_Click(object sender, EventArgs e)
 {
     Solution     = new CaptchaSolution(txtCaptcha.Text, null, Config.Captcha);
     DialogResult = DialogResult.OK;
     Close();
 }