C#通过shell32获取文件详细备注信息
1.从系统Window/System32文件夹中Copy出 Shell32.dll Com组件
将Shell32.dll文件引用到项目中,并设置“嵌入互操作类型”为false
http://blog.csdn.net/u011127019/article/details/52166033
2.代码实例:
ShellClass sh = new ShellClass();
Folder dir = sh.NameSpace(Path.GetDirectoryName(filename));
FolderItem item = dir.ParseName(Path.GetFileName(filename));
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();
索引说明(视频文件常用属性):
0--文件名称
1---文件大小
2---文件类型
3---修改时间
4---创建时间
8---可用性
27---时长
28--比特率
303--数据速率
304--帧高度
305--帧速率
306--帧宽度
307--视频方向
308--总比特率
3.代码实例(有不可取的地方):
//初始化Shell接口
ShellClass sh = new ShellClass();
//获取文件所在父目录对象
Folder dir = sh.NameSpace(Path.GetDirectoryName(filename));
//获取文件对象的FolderItem对象
FolderItem item = dir.ParseName(Path.GetFileName(filename));
//字典存放属性名和属性值
Dictionary<string, string> dic = new Dictionary<string, string>();
//循环获取详细信息
int i = 0;
while (true)
{
//获取属性名称
string key = dir.GetDetailsOf(null,i);
if (string.IsNullOrEmpty(key))
{
//当无属性可取时,退出循环
break;
}
//获取属性值
string value = dir.GetDetailsOf(item,i);
dic.Add(key,value);
i++;
}
listBox.ItemsSource = dic;
C#通过shell32获取文件详细备注信息的更多相关文章
- C# 获取文件详细备注信息 (如图片、视频实际创建时间)
在整理照片/视频时想根据实际拍摄时间重命名文件,但 System.IO.FileInfo 只能获取到文件的创建时间或最后写入时间,不符合要求,遂寻找解决方案 方案 1: System.Drawing ...
- C#获取FTP文件详细备注信息
private void button1_Click(object sender, RoutedEventArgs e) { Uri uri = new Uri("ftp://192.168 ...
- fsck获取文件的block信息和位置信息
原文链接:lxw的大数据田地 » hdfs fsck命令查看HDFS文件对应的文件块信息(Block)和位置信息(Locations) 关键字:hdfs fsck.block.locations 在H ...
- Windows下通过命令行 获取文件详细信息
@echo off echo version: wmic datafile where Name="C:\\Product\\File\\Release\\1.1.1\\File.exe&q ...
- 利用php获取图片完整Exif信息类 获取图片详细完整信息类
<?php /** * @Author: TonyLevid * @Copyright: TonyLevid.com * @Name: Image Exif Class * @Version: ...
- Thinkphp5获取文件上传信息
Thinkphp5内置有处理文件上传的方法,因在开发文档没有找到获取上传文件基本信息的说明,故在这里做一下记录. $file = request()->file('input类型为file的na ...
- R语言学习笔记(十五):获取文件和目录信息
file.info() 参数是表示文件名称的字符串向量,函数会给出每个文件的大小.创建时间.是否为目录等信息. > file.info("z.txt") size isdir ...
- C#开发BIMFACE系列6 服务端API之获取文件信息
在<C#开发BIMFACE系列4 服务端API之源上传文件>.<C#开发BIMFACE系列5 服务端API之文件直传>两篇文章中详细介绍了如何将本地文件上传到BIMFACE服务 ...
- C#开发BIMFACE系列7 服务端API之获取文件信息列表
系列目录 [已更新最新开发文章,点击查看详细] 本文详细介绍如何获取BIMFACE平台中所有上传过的文件信息列表. 请求地址:GET https://file.bimface.com/file ...
随机推荐
- ArcFace Android 人脸检测与人脸识别集成分享
目前我们的应用内使用了 ArcFace 的人脸检测功能,其他的我们并不了解,所以这里就和大家分享一下我们的集成过程和一些使用心得集成ArcFace FD 的集成过程非常简单在 ArcFace FD 的 ...
- 学习笔记6—pandas中ix,loc,iloc有什么区别?
直接看例子: >>> data = pd.Series(np.arange(10), index=[49,48,47,46,45, 1, 2, 3, 4, 5]) >>& ...
- nRF52832-PPI部分学习
PPI部分学习思维导图 PPI原理 1.1PPI简介 PPI实现的就是通过初始化配置,将不同外设的事件和任务连接起来,让事件自动去触发任务的功能,PPI有多个通道, 每个通道包含一个EEP和TEP,使 ...
- Linux命令echo
echo "hello world" echo 显示字符串内容
- Codeforces 987 F - AND Graph
F - AND Graph 思路: 首先,x & (~x) == 0 其次,~x 的 子集 y = ((~x) ^ (1<<k)), 0<= k < n(如果k这一位是 ...
- boostrapt的二级下拉菜单
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta conte ...
- bootstrap的渲染机制
bootstrap的渲染机制. http://www.cnblogs.com/djtao/p/5942620.html 源码解析: http://www.cnblogs.com/ahole/p/588 ...
- Linux 各种软件的安装-mediawiki + wordpress篇
php apache mysql 三剑客安装好后,可以愉快地安装一些成熟的web应用啦,比如wordpress可以当做自己的笔记本,mediawiki整理知识库. 首先是mediawiki,网上说不错 ...
- ffmpeg 加 logo
How to add a watermark or logo to any corner or the center of a video with FFMPEG. ffmpeg –i video.m ...
- 雷林鹏分享:XML 相关技术
XML 相关技术 下面是一个 XML 技术的列表. XHTML (可扩展 HTML) 更严格更纯净的基于 XML 的 HTML 版本. XML DOM (XML 文档对象模型) 访问和操作 XML 的 ...