【发布时间】:2016-12-10 08:58:59
【问题描述】:
我正在开发一个 Youtube 下载器,我使用 Path.combine,但是当我启动我的程序并在字段中放置一个 url 时,我收到了这个错误:
路径中有非法字符
progressBar.Minimum = 0;
progressBar.Maximum = 100;
if (!(txturl.Text == string.Empty))
{
try
{
IEnumerable<VideoInfo> videos = DownloadUrlResolver.GetDownloadUrls(txturl.Text);
VideoInfo video = videos.First(p => p.VideoType == VideoType.Mp4 && p.Resolution == Convert.ToInt32(cmbResolution.Text));
if (video.RequiresDecryption)
DownloadUrlResolver.DecryptDownloadUrl(video);
VideoDownloader downloader = new VideoDownloader(video, Path.Combine(Application.StartupPath, video.Title + video.VideoExtension));
downloader.DownloadProgressChanged += downloader_DownloadProgressChanged;
Thread thread = new Thread(() => { downloader.Execute(); }) { IsBackground = true };
thread.Start();
}
catch (Exception yt) { MessageBox.Show(yt.Message); }
}
else { MessageBox.Show("Input field cannot be empty."); }
【问题讨论】: