3
我想讀取音頻文件的「比特率」屬性。我知道如何獲得價值,但我以這樣的方式獲得價值,我不認爲它是最有效率的。是否在索引28中固定「比特率」屬性?
Shell shell = new Shell32.Shell();
Folder objFolder = shell.NameSpace(path);
for (int i = 0; i < short.MaxValue; i++)
{
string property = objFolder.GetDetailsOf(null, i);
if (String.IsNullOrEmpty(property))
break;
if (property.Equals("Bit rate"))
{
index = i;
break;
}
}
FolderItem item = objFolder.ParseName(fileName);
string bitRateValue = objFolder.GetDetailsOf(item, index);
我擔心的是,for循環,我需要得到的「比特率」的指標,所以對於我的所有測試回來我指數28,因此,我開始懷疑,如果比特率始終在索引中28?如果沒有,那麼是否有更好的方法來找出比特率位於哪個索引?