mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-06 05:37:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Roblox.Common
|
||||
{
|
||||
public class MimeTypes
|
||||
{
|
||||
public static string GetExtensionFromMime(string mimeType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var regKey = Registry.ClassesRoot.OpenSubKey($@"Mime\Database\Content Type\{mimeType}", false);
|
||||
if (regKey == null) return null;
|
||||
|
||||
var ext = regKey.GetValue("Extension") as string;
|
||||
if (string.IsNullOrEmpty(ext)) return string.Empty;
|
||||
|
||||
return ext;
|
||||
}
|
||||
catch { return string.Empty; }
|
||||
}
|
||||
public static string GetMimeFromExtension(string ext)
|
||||
{
|
||||
var regKey = Registry.ClassesRoot.OpenSubKey(ext, false);
|
||||
if (regKey == null) return null;
|
||||
|
||||
return regKey.GetValue("Content Type") as string;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user