Here's some advice, as i 'noticed' you were new to C#:
This isn't C# specific, but i'd suggest splitting up functions like Strawpoll_Bot::Program::VoteRequest to prevent the over-indentation/nesting as seen in the respective function.
You should be using string interpolation to format strings instead of concating like here.
Eg:
$"http://2captcha.com/in.php?key={captchakey}&method=userrecaptcha&googlekey={sitekey}&invisible=1&pageurl={currenturl}";
I don't have any experience with 2captcha, only anti-captcha, but from the information on 2captchas site, it seems very overpriced (anti-captcha is $1 cheaper per 1000 solves). I've never had any issues with anti-captcha, anyway, and it was definitely solving faster than 30 seconds.
KeyValuePairs can be implicitly converted using { }
, eg.
var formcontent = new FormUrlEncodedContent(new[]
{
{ "security-token", sectoken },
{ authtoken, "" },
{ "g-recaptcha-response", capresponse },
{ "options", option }
});
This is a really 'dirty' function that could be improved a lot (readability). I assume you have coded legacy c before? (You're defining a ton of variables at the top of the function where they are not actually needed. :)
You really should be using a proper html-parser like AgileHtml instead of splitting strings like you are doing here.
Don't do this or this, you're needlessly bottlenecking :)
Don't do this or this, you should be using the using
statement to automatically dispose when objects leave scope.
Eg:
using (var voteclient = new HttpClient(handler))
{
...
}
Use TryParse instead of converting like this.
I'm not quite sure whether or not it's a problem, but your code style might be hard to read when the variable names get longer, as local variables do not have a distinct delimiter. I would suggest snake_case, but you can also just do partial CamelCase, eg. (camelCase) for local variables ๐ (You also are not completely consistent in your naming convention)
Code looks clean besides all of the above. You're not consistent in using var but that's not really an issue ๐