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


    项目中引用 Shell32.dll;

    1. using System.IO;
    2. using Shell32;
    3. ShellClass sh = new ShellClass();
    4. Folder dir = sh.NameSpace(Path.GetDirectoryName(strPath));
    5. FolderItem item = dir.ParseName(Path.GetFileName(strPath));
    6. StringBuilder sb = new StringBuilder();
    7. for (int i = -1; i < 50; i++)
    8. {
    9. // 0 Retrieves the name of the item.
    10. // 1 Retrieves the size of the item.
    11. // 2 Retrieves the type of the item.
    12. // 3 Retrieves the date and time that the item was last modified.
    13. // 4 Retrieves the attributes of the item.
    14. // -1 Retrieves the info tip information for the item.
    15. sb.Append(i.ToString());
    16. sb.Append(":");
    17. sb.Append(dir.GetDetailsOf(item, i));
    18. sb.Append("/r/n");
    19. }
    20. 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:

  • 相关阅读:
    python条件判断之直接加数字
    pythontip题目解答
    twitter api取出的日期格式化
    MySQL Archive存储引擎
    Python Json序列化
    Python 装饰器
    Python 匿名函数
    Python 函数
    Python 字符编码
    Python 文件操作
  • 原文地址:https://www.cnblogs.com/anakin/p/2230719.html
Copyright © 2020-2023  润新知