多线程下载TS文件
aria2c下载TS文件
aria2c 是一个用来下载文件的实用程序。支持HTTP(S), FTP, SFTP, BitTorrent,和Metalink协议。我们可以调用aria2c来下载具体的TS文件。
具体c#代码:
var url = this.cururlpath + curdownfile;
var tool = @“aria2c.exe”;
var fi = new FileInfo(textBox6.Text + “\” + textBox9.Text + “\” + curdownfile);
var command = " -c -s 10 -x 10 --file-allocation=none --check-certificate=false -d " + fi.DirectoryName + " -o " + fi.Name + " " + url;
//Console.WriteLine(command);
using (var p = new Process())
{
RedirectExcuteProcess(p, tool, command, (s, e) => ShowDownInfo(i,url, e.Data));
}
在ShowDownInfo回调函数中基于返回的输出,进行相应的判断:
if (a == null) return;