库核实头文件格式 [英] Libraries to verify file format by header

查看:102
本文介绍了库核实头文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有几次在过去几个月我已经被它验证文件格式的相同任务的标题:JPEG,PDF,Word和其它流行的文件

A few times in the last couple months I had the same task of verifying the file format by it's header: JPEG, PDF, Word, and other popular files.

我不知道是否有一个图书馆出售中的C#/。NET这样做呢? 或者是在某个时间启动一个小项目的NuGet目录?

I wonder if there is a library availble for C#/.Net to do that? Or is it a time to start a small project for NuGet catalogue?

推荐答案

对于那些谁将会在未来发现这样一个问题:我已经开始写库。有一次,我有显著量不同类型的,我会提交给的NuGet。但此刻的源$ C ​​$ C可以在这里找到: HTTP://filetypedetective.$c$cplex。 COM /

For those who will find this question in the future: I have started to write the library. Once I have significant amount of different types, I'll submit it to NuGet. But at the moment the source code is available here: http://filetypedetective.codeplex.com/

该库的想法是能够调用 isPdf() isZip()的FileInfo 目标:

The idea of the library is to be able to call isPdf() or isZip() on FileInfo objects:

FileInfo file = new FileInfo("C:\Hello.pdf");
if ( file.isPdf())
    Console.WriteLine("File is PDF");

等。

更新:在终于得到了各地创造的NuGet包:

Update: the finally got around to create nuget package:

安装,包装FileTypeDetective

Install-Package FileTypeDetective

这篇关于库核实头文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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