您的位置:首页 > 编程语言 > C#

C#获取文件详细备注信息

2011-10-31 20:45 253 查看
项目中引用 Shell32.dll;

using System.IO;
using Shell32;

ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(Path.GetDirectoryName(strPath));
FolderItem item = dir.ParseName(Path.GetFileName(strPath));
StringBuilder sb = new StringBuilder();
for (int i = -1; i < 50; i++)
{
// 0 Retrieves the name of the item.
// 1 Retrieves the size of the item.
// 2 Retrieves the type of the item.
// 3 Retrieves the date and time that the item was last modified.
// 4 Retrieves the attributes of the item.
// -1 Retrieves the info tip information for the item.
sb.Append(i.ToString());
sb.Append(":");
sb.Append(dir.GetDetailsOf(item, i));
sb.Append("/r/n");
}
string c = sb.ToString();

结果:

-1:艺术家: 谭晶
唱片标题: 北京2008奥运会歌曲专辑
发行年: 2008
曲目号码: 20
持续时间: 0:04:21
类型: MP3 格式声音
比特率: 128kbps
受保护: 否
大小: 3.98 MB -----全部

0:一起飞(谭晶 阎维文).mp3 ------文件名
1:4,083 KB ------文件大小
2:MP3 格式声音 -----文件类型
3:2008-9-3 12:58 -----修改时间
4:2008-8-26 11:44 ------创建时间
5:2008-9-3 12:58 ------访问时间
6:A

7:在线
8:Administrators
9:谭晶 -------作者
10:一起飞 -------标题
11:
12:Pop -----------流派
13:
14:思恒网—新闻工作者的摇篮!ww -------备注
15:
16:谭晶 -----艺术家
17:北京2008奥运会歌曲专辑 -----唱片标题
18:2008 -----发行年
19:20 ------曲目号码
20:Pop -----流派
21:0:04:21 ------持续时间

22:128kbps ------比特率
23:否 -----受保护
24:
25:
26:
27:
28:
29:
30:
31:
32:0 位
33:44 kHz ------音频采样级别
34:2 (立体声) -------频道
35:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: