如何解决从GetDetailsOf获得的Shell32属性在各个文件夹中是否发生变化?
我在C#应用程序中使用Shell32从多个目录中的文件(特别是从多个文件夹中的图片)获取扩展属性。我在SO上发现here的一种技术(效果很好)是:
public static void Main(string[] args)
{
List<string> arrHeaders = new List<string>();
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder objFolder;
objFolder = shell.NameSpace(@"C:\temp\testprop");
for( int i = 0; i < short.MaxValue; i++ )
{
string header = objFolder.GetDetailsOf(null,i);
if (String.IsNullOrEmpty(header))
break;
arrHeaders.Add(header);
}
foreach(Shell32.FolderItem2 item in objFolder.Items())
{
for (int i = 0; i < arrHeaders.Count; i++)
{
Console.WriteLine(
$"{i}\t{arrHeaders[i]}: {objFolder.GetDetailsOf(item,i)}");
}
}
}
我做了一点调查,发现C:驱动器上所有文件夹的属性名称(显然不是它们的值)都相同。有谁知道我能指望吗? (我正在使用Windows10。)我似乎找不到很多好的Microsoft文档。
[编辑]我编写了一个快速程序,可以扫描所有目录,然后计算其中有多少个具有哪些属性。结果是这样;除了大多数(但不是全部)属性以外,我不确定它能告诉我什么(大多数(但不是全部)文件夹中):
Attribute Directories
------------------------- -----------
# 203485
Album 203485
Attributes 203485
Authors 203485
Availability 203485
Bit rate 203485
Camera maker 203485
Camera model 203485
Categories 203485
Category 1
Collection 1
Comments 203485
Company 203485
Conductors 203485
Contributing artists 203485
Copyright 203485
Creation Date 1
Date accessed 203485
Date created 203486
Date Deleted 1
Date modified 203488
Date taken 203485
Designed for 1
Designer/foundry 1
Dimensions 203485
Family 1
File description 203485
Folder path 2
Font embeddability 1
Font file names 1
Font style 1
Font type 1
Font version 1
Genre 203485
Item type 203487
Kind 203485
Last Accessed 1
Last Synchronization 1
Length 203485
Location 1
Masters keywords 406974
Name 203489
Offline status 203485
Original Location 1
Owner 203485
Perceived type 203485
Program File 1
Protected 203485
Rating 203485
Show/hide 1
Size 203489
Status 2
Subject 203485
Tags 203487
Time Period 1
Title 203485
Total Size 1
Version 1
Year 203485
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。