添加命名空間:
using Shell32;
using System.Text.RegularExpressions;
添加引用:COM組件的Microsoft Shell Controls And Automation
string dirName = Path.GetDirectoryName(SongPath);
SongName = Path.GetFileName(SongPath);//獲得歌曲名稱
FileInfo fInfo = new FileInfo(SongPath);
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(dirName);
FolderItem item = dir.ParseName(SongName);
SongTime = Regex.Match(dir.GetDetailsOf(item, -1), "\\d:\\d{2}:\\d{2}").Value;//獲取歌曲時間
using Shell32;
using System.Text.RegularExpressions;
添加引用:COM組件的Microsoft Shell Controls And Automation
string dirName = Path.GetDirectoryName(SongPath);
SongName = Path.GetFileName(SongPath);//獲得歌曲名稱
FileInfo fInfo = new FileInfo(SongPath);
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(dirName);
FolderItem item = dir.ParseName(SongName);
SongTime = Regex.Match(dir.GetDetailsOf(item, -1), "\\d:\\d{2}:\\d{2}").Value;//獲取歌曲時間