private byte[] DownloadBytes(string url, NameValueCollection data, Proxy proxy, string requiredString = null, CookieContainer cookies = null, string referer = null)
{
if (requiredString == null)
{
requiredString = RequiredString;
}
HttpClient client = CreateHttpClient();
client.Proxy = proxy;
if (cookies != null)
{
client.Cookies = cookies;
}
if (referer != null)
{
client.Referer = referer;
}
try
{
return(client.DownloadBytes(url, data));
}
catch (WebException e)
{
if (e.Response != null && (e.Response as HttpWebResponse).StatusCode == HttpStatusCode.NotFound)
{
throw new WebPageNotFoundException();
}
proxy.IsOnline = false;
}
return(null);
}