No description, website, or topics provided.
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Properties initial commit after move Jan 6, 2012
Tests
docs some refactoring to bring up method names up to a standard with .Net … Sep 7, 2012
packages initial commit after move Jan 6, 2012
.hgignore test files Jan 8, 2012
Detective.cs some refactoring to bring up method names up to a standard with .Net … Sep 7, 2012
FileType.cs some refactoring to bring up method names up to a standard with .Net … Sep 7, 2012
FileTypeDetective.csproj Gif is fixed Jan 9, 2012
FileTypeDetective.csproj.VisualState.xml Exe and MSI types Mar 5, 2012
FileTypeDetective.sln initial commit after move Jan 6, 2012
FileTypeDetective.sln.DotSettings.user some refactoring to bring up method names up to a standard with .Net … Sep 7, 2012
FileTypeDetective.sln.docstates.suo
FileTypeDetective.suo some refactoring to bring up method names up to a standard with .Net … Sep 7, 2012
FileTypeDetective.v11.suo some refactoring to bring up method names up to a standard with .Net … Sep 7, 2012
README.md
TestResult.xml Exe and MSI types Mar 5, 2012
WikiFiles.zip Add files via upload Apr 3, 2017

README.md

This project is pretty much abandoned. But there is a fork on GitHub: https://github.com/Muraad/Mime-Detective These guys have a lot more types detectable, but no NuGet package yet -(

This repo has been migrated from https://filetypedetective.codeplex.com/

Description

Library to decide what type of file we are working with. Detects file types by header, not by file extension.

Every file has an extension and if it is a binary file, it has magic numbers in the header of the file that indicate what type of file it is. It is not always easy to work out programmatically what type of file it is, if there is no (or incorrect) extension. This library provides an easy way of identifying the file types.

At the moment library can detect files of types: Microsoft Word, Microsoft Excel, Microsoft PowerPoint, PDF, JPEG, ZIP, RAR, RTF, PNG, GIF

Great news. Nuget package is now available:

PM> Install-Package FileTypeDetective

Not many types are supported, I know! But it is easy to extend and add new types yourself. If you require new types, please let me know.

Downloadable zip includes source code, compiled DLL file and help file with API description (generated from XML comments). Or you can download the entire project from the source code and have a bash-on yourself. Source code also includes unit-tests.

The idea of the library is to be able to call isPdf(), isZip(), isDoc(), ect. on FileInfo objects:

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

There are some examples on Documentation page.