/// <summary> /// Creates a MimeType for a file extension using the OS registered applications /// for that file type. /// </summary> /// <param name="fileExtension">string (e.g. "pdf" or ".pdf")</param> /// <returns>MimeType</returns> /// <permission cref="RegistryPermission">Read access to HKEY_CLASSES_ROOT\MIME</permission> public static MimeType CreateFromRegisteredApps(string fileExtension) { if (fileExtension == null) { return(Empty); } string dotExt = (fileExtension.IndexOf(".") >= 0 ? fileExtension : "." + fileExtension); string mType = WindowsRegistry.GetMimeTypeString(dotExt); if (mType == null) { return(Empty); } return(new MimeType(mType)); }