Windows 文件属性/文件版本
我知道对于 dll 文件,您可以读取程序集版本,但我想知道是否有某种方法可以标记或读取任何文件类型(例如 jpg)的版本。我正在制作一个更新程序,仅更新必要的内容,如果所有文件都进行版本控制,而不是在单独的文件中跟踪版本,那就更好了。
哦,这是针对 winXP 的,但如果我有一个 win7/windup 解决方案那就太棒了。
I know for dll files you can read an Assembly version, but I was wondering if there's some way to mark or read versions from ANY filetype (jpg for example). I'm making an update program that only updates what's necessary and it'd be better if all files were versioned instead of keeping track of versions in a separate file.
Oh and this is intended for winXP but if I there is a win7/windup solution that'd be awesome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
程序集的版本是特定于程序集文件格式的。一般的“文件”(例如 JPEG 文件)只是一包位,Windows 文件系统没有任何与此类文件关联的“版本”元数据。
解决问题的一种方法可能是计算文件内容的哈希值(例如使用 SHA1)。如果您有两个文件并且 SHA1 哈希值匹配,那么您可以非常确定完整的内容也匹配。 (您无法确定嵌入式文件版本。)
The version of an assembly is something that is specific to the assembly file format. A general "file" (such as a JPEG file) is just a bag of bits and the Windows filesystem doesn't have any "version" metadata associated with such a file.
One approach to solve your problem might be to compute a hash (such as using SHA1) over the content of the file. If you have two files and the SHA1 hashes match, then you can be pretty darn sure that the complete contents also match. (You can't be that sure with an embedded file version.)