Tag: 文件属性

索引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); 我担心的是,我需要得到“比特率”索引的循环,所以我的所有测试都返回索引28,因此我开始怀疑是否可以始终在索引28找到比特率? 如果没有那么有没有更好的方法来找出比特率位于哪个位置?

C#make文件从readonly读/写

如果File.SetAttributes(“C:\\myFile.txt”, FileAttributes.ReadOnly); 将文件设置为只读,如果需要,如何将其设置为读/写? 我怀疑它将是FileAttributes.Normal但是这会改变文件的任何其他属性吗? MSDN网站上没有非常具有描述性的说明…… 该文件是正常的,没有设置其他属性。 仅当单独使用时,此属性才有效。 谢谢