我正在开发一个需要通过torrent下载目录(大小为11 GB)的应用程序,但它只创建0字节文件。使用小体积(~100 MB)进行测试时 - 一切都很好。我尝试了来自不同跟踪器的torrent文件,没有任何反应。怎么了?帮助...
public void InitTorrent(string savePath)
{
this.engine = new ClientEngine(new EngineSettings());
this.savePath = savePath;
CPBMax = 100;
CPBMin = 0;
CPBVal = 0;
}
public void DownloadTorrent(string path)
{
Torrent torrent = Torrent.Load(path);
TorrentManager manager = new TorrentManager(torrent, savePath, new TorrentSettings());
engine.Register(manager);
double TorrentSize = manager.Torrent.Size;
TorrentSize = Math.Round(TorrentSize/(1024 * 1024), 1);
double TorrentProcess = 0;
double TorrentDowload = 0;
string HashSumm = manager.InfoHash.ToString();
TProcess = "Проверка мода";
if (HashSumm != Hash)
{
// Запуск
manager.Start();
bool _running = true;
TProcess = "Загрузка мода";
while (_running)
{
if (manager.State == TorrentState.Stopped)
{
_running = false;
}
BTNPlayEn = 0;
TorrentDowload = manager.Monitor.DataBytesDownloaded;
TorrentProcess = Math.Round(manager.Progress, 1);
if (manager.Progress > 0.0 ^ engine.TotalDownloadSpeed > 0.0)
{
CPBIndet = 0;
}
CPBVal = TorrentProcess;
Version = "Загружено: " + Math.Round((TorrentSize * TorrentProcess)/100, 1) + "/" + TorrentSize + " Mb" + " ⇓ " + Math.Round(engine.TotalDownloadSpeed / 1024.0, 1) + " kB/sec";
}
Version = "Завершено";
//CPBIndet = 0;
if (TorrentProcess == 100)
{
Hash = HashSumm;
TProcess = "Готов к запуску";
BTNPlayContent = "Играть";
BTNPlayEn = 1;
// CPBIndet = 0;
}
SetSettings();
}
else
{
TProcess = "Готов к запуску";
//CPBIndet = 0;
}
}