Дополнен 3 года назад
public bool getCaptcha()
{
if (this.gonaStop)
{
this.locked = true;
this.stopped = false;
this.blocked = true;
this.requestTime = 0L;
}
this.locked = true;
Connecter connecter = new Connecter
{
cookies = this.cookiesG
};
HttpWebRequest newRequest = connecter.GetNewRequest(connecter.OriginUrl + "/captcha/" + this.accountToken, connecter.cookies);
System.Net.ServicePointManager.Expect100Continue = false;
System.Net.ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.FindServicePoint(new Uri(connecter.OriginUrl));
Dictionary parameters = new Dictionary();
string input = "";
parameters = null;
HttpWebResponse response = connecter.MakeRequest(newRequest, connecter.cookies, parameters, 2);
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
if (!reader.EndOfStream)
{
input = input + reader.ReadToEnd();
}
}
response.Close();
this.RES = input;
this.captcha = JsonConvert.DeserializeObject<Dictionary>(input);
if ((this.captcha != null) && (this.captcha["status"].ToString() == "success"))
{
return true;
}
if (((this.captcha != null) && (this.captcha["error"] != null)) && (this.captcha["error"].ToString() != "null"))
{
this.blocked = true;
}
return false;
}
{
Connecter connecter = new Connecter();
HttpWebRequest newRequest = connecter.GetNewRequest(connecter.OriginUrl + "login", connecter.cookies);
System.Net.ServicePointManager.Expect100Continue = false;
System.Net.ServicePointManager.UseNagleAlgorithm = false;
newRequest.ServicePoint.ConnectionLimit = 15;
ServicePointManager.FindServicePoint(new Uri(connecter.OriginUrl));
newRequest.KeepAlive = true;
newRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
Dictionary parameters = new Dictionary {
{
"email",
this.accountEmail
},
{
"password",
this.accountPass
},
{
"request_type",
"ajax"
}
};
string input = "";
HttpWebResponse response = connecter.MakeRequest(newRequest, connecter.cookies, parameters, 1);
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
if (!reader.EndOfStream)
{
input = input + reader.ReadToEnd();
}
}
response.Close();
this.cookiesG = connecter.cookies;
return (JsonConvert.DeserializeObject<Dictionary>(input)["status"].ToString() == "success");
}