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 ...
随机推荐
- PCB板的三种敷铜方法解析
1 do not pour over all same net objects:仅仅对相同网络的焊盘进行连接,其他如覆铜.导线不连接. 2 pour over all same net objects ...
- ie67的冷知识
1. _display:inline;是什么意思 只有ie6认识带下划线的,一般这种写法是用来消除ie6对margin双倍的bug的,比如你写margin-left:10px;那么ie6下显示的是20 ...
- Opencv各种编码器下视频文件大小对比
转载自http://blog.csdn.net/dcrmg/article/details/52215930 做视频样本切割,切片用ffv1编码,比原数据大了几十倍,看到了这篇文章,防止找不到记录一下 ...
- InitializingBean和DisposableBean
InitializingBean 记住一点:InitializingBean接口为bean提供了初始化方法的方式,它只包括afterPropertiesSet方法,凡是继承该接口的子类,在初始化bea ...
- 停止学习框架(Stop Learning Frameworks)
https://www.cnblogs.com/strick/p/10161733.html
- 动手动脑java异常处理
1>请阅读并运行AboutException.java示例,然后通过后面的几页PPT了解Java中实现异常处理的基础知识. import javax.swing.*; class AboutEx ...
- 2.7 UML状态图
问题的引出 顺序图是对对象的动态行为进行建模,有多个对象的参与.协作 问题: 当需要考察单个实体的动态行为时, 用UML如何来建模呢? 什么是单个实体:一个软件系统?一个子系统?一个模块.一个构件? ...
- 『流畅的Python』第10章笔记_序列类型
一.基础知识 “__”前缀:私有属性.方法,在__dict__中存储时被改写为“_类名__”前缀 “_”前缀:是约定俗成的保护属性.方法,不过编译器不会对之采取任何处理 二.class特殊方法介绍 在 ...
- vue中使用transition标签底部导航闪烁问题
<transition :name="transitionName" :duration="{ enter: 500, leave: 0 }" > ...
- HomeBrew的安装和简单使用
homebrew 官网 https://brew.sh/ 转自:http://blog.csdn.NET/maojudong/article/details/7918291 1. 前言 作为Linu ...