在WPF应用程序中为文件选择标记方法 [英] Choosing a tagging method for files in a WPF application

查看:59
本文介绍了在WPF应用程序中为文件选择标记方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最终目标:
我的最终目标是在应用程序中组织大量文件.
有点像摄影中一样,所有文件都可以具有标准属性(TAG?)(例如Camera,Aperture,Date等)以及用户喜欢的类别(标签)(例如Brother,Sunset,Nature).
最终,文件的组织原则不由我决定.
那并不意味着我不会推荐一种结构,而是意味着使用标签来驱动搜索和分类工具将是一个很好的选择.
用户通常会继承一堆文件,其中文件名本身会以一种隐秘的方式告诉您起源,并可能在此基础上建议TAGS使用.为此,在文件后跟随一个标签将非常有用.

我一直在寻找从WPF应用程序中标记文件的方法.要标记的文件将是文件夹结构中的任何文件(在本地硬盘驱动器或网络驱动器上),这些文件是文本和二进制(专有)文件.

带有TAG时,我指的是自由文本属性和专用属性或关联(例如,"Date Of Birth = 02052003",其中"Date Of Birth"是预定义的非常有用的标签,可以通过该标签进行组织(某些例程可能能够基于这些标签).

我已经看到了MS Office文件的属性,并且非常喜欢这样标记的想法(如果在用户之间交换文件,这种方式会保留在文件中),但是该方法不能在专有二进制文件上使用.

该应用程序将不总是可以访问Internet.

是否有用于标记文件的标准-或者我应该只是实现自己的数据库并跟踪那里的标记?

欢迎任何想法.

Ultimate goal:
My ultimate goal is to organise a humongous mess of files in an application.
A bit like in photography there are Standard properties (TAGs?) that all files could have (e.g. Camera, Aperture, Date, etc.) and also categories (tags) that users fancy (e.g. Brother, Sunset, Nature).
Ultimately the organising principle for the files are not up to me to decide.
That doesn''t mean that I wont recommend a structure, but it means that using tags to power a search and categorisation tool would be a great.
Often the user inherits a mess of files where the filename it self in a cryptic way tells about the origin and could suggest TAGS to use on the basis of that. For this purpose a tag that follows the file would be great.

I have been looking for methods to tag files from within a WPF application. The files to tag will be any files in a folder structure (on local hard drives or on network drives) the files are text and binary (proprietary) files.

With a TAG I mean both freetext and dedicated properties or associations (for example "Date Of Birth = 02052003" where "Date Of Birth" is a predefined very useful tag to have and organise by (Certain routines may be able to automate tasks based on these tags).

I''ve seen the MS office file properties and quite like the idea of tagging like that (in a way that stays with the file if it is exchanged between users), but the method can''t be used on the proprietary binaries.

The application will not always have access to the internet.

Is there a standard for tagging files - or should I just implement my own database and keep track of tags there?

Any ideas welcome.

推荐答案

这实际上取决于您打算对文件进行什么处理. Office标记存储在文件的特殊属性中,并使用Shell扩展名将其显示出来.这使您可以在用户之间传输文件,因为属性实际上是文件的一部分.

如果您打算将这些文件的副本保存在一台机器上,并且使用的是NTFS,则可以使用称为备用数据流"(ADS)的文件将任意标签与文件相关联,该文件不将属性存储在文件中,而是在其他地方保留一份副本. 链接. [互操作 [ ^ ].

如果您只想存储标签,并且文件可以在机器之间移动,那么您可能应该考虑使用数据库来存储标签.
It really depends on what you are planning to do with the files. The Office tags are stored in special properties in the file, and these are displayed out using a shell extension. This allows you to transfer the files between users because the properties are actually part of the files.

If you intend to keep a copy of these files on one machine, and you are using NTFS, you can associate arbitrary tags with the file using something called Alternate Data Streams (ADS), which doesn''t store the attributes in the file, but rather keeps a copy elsewhere. Link.[^] Note that this method will require you to get your hands dirty and do a lot of interop[^].

If you want to just store the tags, and the files can be moved between machines, then you should probably consider the use of a database just to store the tags. This is probably going to be the easier method.


坏主意!
不,没有标准的标记方法.我认为,这是因为系统的创建者也会认为这是一个坏主意.

如果您解释自己的最终目标(不被自己的建筑想法所污染),则可能有机会获得一些更好的想法并提出建议.


您始终可以创建一个与文件系统本身平行的数据系统,该数据系统将所有与文件名相关联的文件的标签保存在真实"文件系统中.您可以将它们全部存储在单独的单个文件中,无论是否在同一文件系统/卷中.某些问题将是与真实"文件系统的同步-文件往往被移动,重命名,删除或创建.订阅文件系统事件可以解决此问题.例如,对于.NET,它是通过类System.IO.FileSystemWatcher完成的.

—SA
Bad idea!
No, there are no a standard tagging method. I think, this is because creators of the system would also think it would be a bad idea.

If you explain your ultimate goals (not contaminated with your own architectural ideas you''re preoccupied with) you might have a chance to get and advice on some better idea.


You can always create a data system parallel to the file system itself which hold the tags all files associated with the file names in a "real" file system. You can store it all in a separate single file, not matter in the same file system/volume or not. Some problem would be synchronization with the "real" file systems — files tend to be moved, renamed, deleted or created. This problem can be solved be subscribing to the file system events. For example, with .NET it''s done via the class System.IO.FileSystemWatcher.

—SA


这篇关于在WPF应用程序中为文件选择标记方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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