检测更改,添加到Windows 7中的库 [英] Detecting changes, additions to Libraries in Windows 7

查看:77
本文介绍了检测更改,添加到Windows 7中的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我希望能够编写一个程序来检测视频库中的更改。具体来说,我想在添加新文件后执行操作。 (我想将添加到库中的任何视频文件转换为移动格式并将它们存储在指定的文件夹中)

我已阅读 Yochay Kiriaty api for Libraries。即使在那些文章中,似乎为了检测说新文件是否被索引,您需要轮询库对象。如果我理解正确你创建了一个 IShellLibrary 类型的对象,请调用GetFolders(),然后将 IShellItemArray 与上次扫描时的对象进行比较,可能存储在记忆。

甚至可以从.net Wrapper获得类似于ShellItemArray的东西?有没有办法真正列出库中的文件,而不仅仅是创建/添加/删除库?

如果有一个发布/订阅系统,如果新文件被索引,我更喜欢调用我的回调函数并传递有关文件(网址,名称等)的信息。由于图书馆很新,我很难看到这是否可以通过谷歌。有没有人有任何建议或知道这是否可行?

-Kellen

Hello, I'd like to be able to write a program that detects changes in my video library.  Specifically I'd like to perform an action once a new file is added.  (I'd like to convert any video files added to the library to a mobile format and store them in a specified folder)

I've read over the articles by Yochay Kiriaty which outline a native api for Libraries.  Even in those articles it seems like in order to detect say if a new file was indexed you'd need to poll a library object.  If I understand correctly you'd create an object of type IShellLibrary , call GetFolders(),  and then compare the IShellItemArray to one that you have from last scan, presumably stored in memory.

Also is it even possible to get something similar to  ShellItemArray from the .net Wrapper?  Is there any way to actually list the files in a library rather than just creating/adding/removing libraries ?

I'd prefer if there was a publish / subscribe system where if a new file is indexed, a callback of mine is called and information about the file (url, name, etc) is passed in.  Since Libraries are quite new I'm having trouble seeing if this is possible via google.  Does anyone have any suggestions or know if this is even feasible?

-Kellen

推荐答案

也是代码示例中的windows 7 sdk显示指向"Videos.library-ms"的FileSystemWatcher。文件。这似乎可以工作,所以我写了一个快速的控制台应用程序处理任何写入文件。不幸的是,我可以看到文件属性更改了该特定文件的日期(例如,如果我将文件夹添加到库中)但是更改的事件不会触发。

图书馆的索引也是如此新文件,它似乎不一定修改"Videos.library-ms"。文件。
-Kellen
Also the code examples in the windows 7 sdk show a FileSystemWatcher pointing at the "Videos.library-ms" file.  This seems like it would work so I wrote a quick console app handleing any writes to the file.  Unfortunatly I can see the file properties change the date on that particular file (for example if I add a folder to the library) and yet the changed event doesn't fire.

Also of the library indexes a new file, it doesn't necessarily seem to modify the "Videos.library-ms" file.
-Kellen


这篇关于检测更改,添加到Windows 7中的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆