【发布时间】:2018-07-28 09:37:01
【问题描述】:
我想在单击按钮后通过打开文件对话框选择一个 mp3 文件并将文件名更改为已指定的字符串。问题是当我将TagLib.File.Create() 的文件路径作为变量插入时,我得到一个 FileNotFound 异常。
代码如下:
public partial class Form1 : Form
{
OpenFileDialog ofd = new OpenFileDialog();
string location = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ofd.ShowDialog();
location = ofd.SafeFileName;
var target = TagLib.File.Create(location);
target.Tag.Title = "it works";
target.Save();
}
}
【问题讨论】: