do {
var image = System.Drawing.Image.FromFile(project.Variables["Captcha_file"].Value);
string base64String = String.Empty;
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
byte [] imageBytes = ms.ToArray();
base64String = Convert.ToBase64String(imageBytes);
}
string res = ZennoPoster.CaptchaRecognition("RuCaptcha.dll", base64String, String.Empty);
var split = res.Split(new [] {"-|-"}, StringSplitOptions.RemoveEmptyEntries);
if (split.Length == 2)
{
project.Variables["Captcha_answer"].Value = split[0];
}
else project.Variables["Captcha_answer"].Value = res;
}
while (project.Variables["Captcha_answer"].Value=="sorry");