提示用户输入保存路径?
Prompt user for save path?
该函数使用包:
https://github.com/flagbug/YoutubeExtractor
我正在尝试让此功能提示用户输入正在下载的文件的保存路径。
目前这是它在调用函数时告诉我的内容:
System.UnauthorizedAccessException: 访问路径 'C:\Program Files (x86)\IIS Express.mp4' 被拒绝。
protected void SaveVideo_Command(object sender, CommandEventArgs e)
{
var RowID = e.CommandArgument;
int submissionIDColumn = Convert.ToInt32(RowID);
var data = ParentSelect.DataKeys[submissionIDColumn]["SubmissionID"].ToString();
int ParseDataInt = Convert.ToInt32(data);
var query = (from r in dbContext.Mains
where r.SubmissionID.Equals(ParseDataInt)
select r);
foreach (var record in query)
{
var VideoID = record.VideoUrl.FirstOrDefault();
var link = "https://www.youtube.com/watch?v=5Mfb9gcB3lM";
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
if (video.RequiresDecryption)
{
DownloadUrlResolver.DecryptDownloadUrl(video);
}
string savePath =
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
Path.ChangeExtension("myVideo", video.VideoExtension));
var videoDownloader = new VideoDownloader(video, video.VideoExtension);
videoDownloader.Execute();
}
dbContext.SaveChanges();
LoadGrid();
}
我想知道的是如何从用户那里得到一个"save path"。显然,从用户那里获取有关本地文件结构的任何本地计算机信息是一个安全漏洞,浏览器专门实现了防止获取此信息的功能。
该函数使用包: https://github.com/flagbug/YoutubeExtractor
我正在尝试让此功能提示用户输入正在下载的文件的保存路径。
目前这是它在调用函数时告诉我的内容: System.UnauthorizedAccessException: 访问路径 'C:\Program Files (x86)\IIS Express.mp4' 被拒绝。
protected void SaveVideo_Command(object sender, CommandEventArgs e)
{
var RowID = e.CommandArgument;
int submissionIDColumn = Convert.ToInt32(RowID);
var data = ParentSelect.DataKeys[submissionIDColumn]["SubmissionID"].ToString();
int ParseDataInt = Convert.ToInt32(data);
var query = (from r in dbContext.Mains
where r.SubmissionID.Equals(ParseDataInt)
select r);
foreach (var record in query)
{
var VideoID = record.VideoUrl.FirstOrDefault();
var link = "https://www.youtube.com/watch?v=5Mfb9gcB3lM";
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
if (video.RequiresDecryption)
{
DownloadUrlResolver.DecryptDownloadUrl(video);
}
string savePath =
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
Path.ChangeExtension("myVideo", video.VideoExtension));
var videoDownloader = new VideoDownloader(video, video.VideoExtension);
videoDownloader.Execute();
}
dbContext.SaveChanges();
LoadGrid();
}
我想知道的是如何从用户那里得到一个"save path"。显然,从用户那里获取有关本地文件结构的任何本地计算机信息是一个安全漏洞,浏览器专门实现了防止获取此信息的功能。