/** * <param name="callback">A delegate to call when the CAPTCHA is solved or timed out.</param> * <param name="img">Raw CAPTCHA image.</param> * <param name="timeout">Solving timeout (in seconds).</param> * <param name="ext_data">Extra data used by special captchas types.</param> */ public void Decode(DecodeDelegate callback, int timeout, Hashtable ext_data = null) { PollPayload payload = new PollPayload(); payload.Callback = callback; payload.Captcha = this.Upload(ext_data); payload.Timeout = timeout; new Thread(PollWithCallback).Start(payload); }
/** * <param name="callback">A delegate to call when the CAPTCHA is solved or timed out.</param> * <param name="img">Raw CAPTCHA image.</param> * <param name="timeout">Solving timeout (in seconds).</param> */ public void Decode(DecodeDelegate callback, byte[] img, int timeout) { PollPayload payload = new PollPayload(); payload.Callback = callback; payload.Captcha = this.Upload(img); payload.Timeout = timeout; new Thread(PollWithCallback).Start(payload); }
protected void PollWithCallback(object state) { PollPayload payload = (PollPayload)state; payload.Callback(this.Poll(payload.Captcha, payload.Timeout)); }