public static string GetMimeType(string fileName) { if (!string.IsNullOrEmpty(fileName)) { string ext = Path.GetExtension(fileName).ToLowerInvariant(); if (!string.IsNullOrEmpty(ext)) { string mimeType = MimeTypes.GetMimeType(ext); if (!string.IsNullOrEmpty(mimeType)) { return(mimeType); } mimeType = RegistryHelpers.GetValueString(ext, "Content Type", RegistryHive.ClassesRoot); if (!string.IsNullOrEmpty(mimeType)) { return(mimeType); } } } return(MimeTypes.DefaultMimeType); }
private static string GetSystemOptionString(string name) { string value = RegistryHelpers.GetValueString(RegistryPath, name, RegistryHive.LocalMachine); if (value == null) { value = RegistryHelpers.GetValueString(RegistryPath, name, RegistryHive.CurrentUser); } return(value); }