Class CaptchaService
Represent a captcha-solving service.
Inheritance
Inherited Members
Namespace: RuriLib.CaptchaServices
Assembly: RuriLib.dll
Syntax
public abstract class CaptchaService
Constructors
| Improve this Doc View SourceCaptchaService(String, Int32)
Creates a captcha service that authenticates via API key.
Declaration
public CaptchaService(string apiKey, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.String | apiKey | The API key of the account |
System.Int32 | timeout | The maximum time to wait for captcha completion |
CaptchaService(String, String, Int32)
Creates a captcha service that authenticates via username and password.
Declaration
public CaptchaService(string user, string pass, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.String | user | The username of the account |
System.String | pass | The password of the account |
System.Int32 | timeout | The maximum time to wait for captcha completion |
Properties
| Improve this Doc View SourceApiKey
The API key to access the captcha service.
Declaration
public string ApiKey { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Pass
The password to access the captcha service.
Declaration
public string Pass { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Status
The status of the captcha service.
Declaration
public CaptchaService.CaptchaStatus Status { get; set; }
Property Value
Type | Description |
---|---|
CaptchaService.CaptchaStatus |
TaskId
The id of the captcha-solving task being performed on the remote server, used to periodically query the status of the task.
Declaration
public dynamic TaskId { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Timeout
The maximum time to wait for captcha completion.
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
User
The username to access the captcha service.
Declaration
public string User { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGetBalance()
Gets the remaining balance in the account.
Declaration
public virtual double GetBalance()
Returns
Type | Description |
---|---|
System.Double | The balance of the account |
GetBase64(Bitmap, ImageFormat)
Gets the base64-encoded string from an image.
Declaration
protected string GetBase64(Bitmap image, ImageFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | image | The bitmap image |
System.Drawing.Imaging.ImageFormat | format | The format of the bitmap image |
Returns
Type | Description |
---|---|
System.String | The base64-encoded string |
GetBytes(Bitmap)
Gets the bytes from an image.
Declaration
protected byte[] GetBytes(Bitmap image)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | image | The bitmap image |
Returns
Type | Description |
---|---|
System.Byte[] | The bytes of the image |
GetStream(Bitmap, ImageFormat)
Gets a memory stream from an image.
Declaration
protected Stream GetStream(Bitmap image, ImageFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | image | The bitmap image |
System.Drawing.Imaging.ImageFormat | format | The format of the bitmap image |
Returns
Type | Description |
---|---|
System.IO.Stream | The memory stream |
PostSync(HttpClient, String, HttpContent)
Performs a synchronous POST request that returns a string.
Declaration
protected string PostSync(HttpClient client, string url, HttpContent content)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Http.HttpClient | client | The HttpClient that performs the async request |
System.String | url | The URL to call |
System.Net.Http.HttpContent | content | The content that needs to be posted |
Returns
Type | Description |
---|---|
System.String | The response as a string |
PostSync2(HttpClient, String, HttpContent)
Performs a synchronous POST request that returns a byte array.
Declaration
protected byte[] PostSync2(HttpClient client, string url, HttpContent content)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Http.HttpClient | client | The HttpClient that performs the async request |
System.String | url | The URL to call |
System.Net.Http.HttpContent | content | The content that needs to be posted |
Returns
Type | Description |
---|---|
System.Byte[] | The response as a byte array |
PostSync3(HttpClient, String, HttpContent)
Performs a synchronous POST request that returns a stream.
Declaration
protected Stream PostSync3(HttpClient client, string url, HttpContent content)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Http.HttpClient | client | The HttpClient that performs the async request |
System.String | url | The URL to call |
System.Net.Http.HttpContent | content | The content that needs to be posted |
Returns
Type | Description |
---|---|
System.IO.Stream | The response as a stream |
SolveCaptcha(Bitmap)
Solves an image captcha challenge.
Declaration
public virtual string SolveCaptcha(Bitmap image)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | image | The bitmap image of the challenge |
Returns
Type | Description |
---|---|
System.String | The text written in the image |
SolveRecaptcha(String, String)
Solves a reCaptcha challenge for a given site.
Declaration
public virtual string SolveRecaptcha(string siteKey, string siteUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | siteKey | The SiteKey found in the page's source code |
System.String | siteUrl | The URL of the site to solve a reCaptcha for |
Returns
Type | Description |
---|---|
System.String | The g-recaptcha-response of the challenge |