Action Recognize= () => {
project.SendInfoToLog("Recognizing", needShowMessages);
try
{
if (!File.Exists(file))
{
fileLoadingError = true;
fileDeleted = true;
return;
}
var bytes = File.ReadAllBytes(file);
if (bytes.Length < 1024)
{
fileLoadingError = true;
return;
}
string str = Convert.ToBase64String(bytes);
var rc = ZennoPoster.CaptchaRecognition("CapMonster2.dll", str, "CapMonsterModule=ZennoLab.AudioReCaptcha&ParallelMode=true");
var split = rc.Split(new [] {"-|-"}, StringSplitOptions.RemoveEmptyEntries);
if (split.Length > 0)
answer = split[0];
if (answer.Contains("133193320491090004119440")) throw new Exception("Your IP was banned!");
}
finally
{
if (File.Exists(file))
{
File.Delete(file);
fileDeleted = true;
}
}
};
Action InputAnswer= () => {
if (!String.IsNullOrEmpty(answer) && answer != "sorry")
{
project.SendInfoToLog("Inserting answer", needShowMessages);
HtmlElement audioAnswerInput = null;
// searching answer input field
if (isRecaptcha1)
{
audioAnswerInput = tab.FindElementByAttribute("input:text", "id", "recaptcha_response_field", "text", 0);
}
else
{
if (isNewView) audioAnswerInput = tab.FindElementByAttribute("input:text", "id", "audio-response", "regexp", 0);
else audioAnswerInput = tab.FindElementByAttribute("input:text", "id", "response", "text", 0);
}
// if found
if (!audioAnswerInput.IsVoid)
{
// inserting answer
audioAnswerInput.SetValue(answer, "None", false);
}
// pause
System.Threading.Thread.Sleep(waitTime);
}
else throw new Exception("Answer not received");
};