private void requestScrapeFromTracker(TorrentInfo torrentInfo)
{
Seeders = -1;
Leechers = -1;
if (checkRequestScrap.Checked && !scrapStatsUpdated)
{
try
{
string text1 = getScrapeUrlString(torrentInfo);
if (text1 == "")
{
AddLogLine("This tracker doesnt seem to support scrape");
}
Uri uri1 = new Uri(text1);
TrackerResponse response1 = MakeWebRequestEx(uri1);
if ((response1 != null) && (response1.Dict != null))
{
string text2 = BEncode.String(response1.Dict["failure reason"]);
if (text2.Length > 0)
{
AddLogLine("Tracker Error: " + text2);
}
else
{
AddLogLine("---------- Scrape Info -----------");
ValueDictionary dictionary1 = (ValueDictionary)response1.Dict["files"];
string text3 = Encoding.GetEncoding(0x4e4).GetString(currentTorrentFile.InfoHash);
if (dictionary1[text3].GetType() == typeof(ValueDictionary))
{
ValueDictionary dictionary2 = (ValueDictionary)dictionary1[text3];
AddLogLine("complete: " + BEncode.String(dictionary2["complete"]));
AddLogLine("downloaded: " + BEncode.String(dictionary2["downloaded"]));
AddLogLine("incomplete: " + BEncode.String(dictionary2["incomplete"]));
updateScrapStats(BEncode.String(dictionary2["complete"]), BEncode.String(dictionary2["incomplete"]), BEncode.String(dictionary2["downloaded"]));
decimal leechers = BEncode.String(dictionary2["incomplete"]).ParseValidInt(-1);
if (Leechers != -1 && (leechers == 0))
{
AddLogLine("Min number of leechers reached... setting upload speed to 0");
updateTextBox(uploadRate, "0");
chkRandUP.Checked = false;
}
}
else
{
AddLogLine("Scrape returned : '" + ((ValueString)dictionary1[text3]).String + "'");
}
}
}
}
catch (Exception exception1)
{
AddLogLine("Scrape Error: " + exception1.Message);
}
}
}