mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
More mime types
This commit is contained in:
parent
2c161a3e26
commit
3865dede56
2 changed files with 1020 additions and 575 deletions
|
@ -255,14 +255,28 @@ public static string GetMimeType(string fileName)
|
||||||
if (!string.IsNullOrEmpty(fileName))
|
if (!string.IsNullOrEmpty(fileName))
|
||||||
{
|
{
|
||||||
string ext = Path.GetExtension(fileName).ToLower();
|
string ext = Path.GetExtension(fileName).ToLower();
|
||||||
RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(ext);
|
|
||||||
if (regKey != null && regKey.GetValue("Content Type") != null)
|
if (!string.IsNullOrEmpty(ext))
|
||||||
{
|
{
|
||||||
return regKey.GetValue("Content Type").ToString();
|
string mimeType = MimeTypes.GetMimeType(ext);
|
||||||
}
|
|
||||||
else
|
if (!string.IsNullOrEmpty(mimeType))
|
||||||
{
|
{
|
||||||
return MimeTypes.GetMimeType(ext);
|
return mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(ext))
|
||||||
|
{
|
||||||
|
if (regKey != null && regKey.GetValue("Content Type") != null)
|
||||||
|
{
|
||||||
|
mimeType = regKey.GetValue("Content Type").ToString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(mimeType))
|
||||||
|
{
|
||||||
|
return mimeType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue