What is the best way open/edit a data Stream if all I have is a MIME type

I am in a Windows Desktop application and I have a data stream and a mime type in the database. Is there a better way than writing it to a temp folder and launching the default editor for it?

If I have to use the temp folder how can I get the file extension from the MIME type in a C# Windows Desktop application?

Answers


Lookup the MIME type in HKEY_CLASSES_ROOT\MIME\Database\Content Type to find out the corresponding file extension and go from there. Some starter links:

If that is not enough, maybe libmagic (used by the file command line tool) or its database can be of use to you, even though it is quite UNIX:y.


Need Your Help

jquery ajaxSubmit return not working

jquery ajax function

I have a function containing an ajaxSubmit inside.

How can we replace of string's specific area with a keyword -PHP

php

I want to replace of string's spesific area with "*". I tried to PHP substr_replace but it doesnt work for me.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.