Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
Silverstone.Manticore.Core.MIMEService Class Reference

Summary description for MIMEService. More...

List of all members.

Static Public Member Functions

static string GetExtensionForMIMEType (string aMIMEType)
 Retrieves the extension associated with the specified content type by looking up the type in the Windows Registry.
static string GetDescriptionForMIMEType (string aMIMEType)
 Retrieves the pretty user-readable description of the type by looking up the type in the Windows Registry. If no data is found, the extension is capitalized and appended with "file", e.g. "ZAP file".

Detailed Description

Summary description for MIMEService.

Definition at line 11 of file MIMEService.cs.


Member Function Documentation

Retrieves the pretty user-readable description of the type by looking up the type in the Windows Registry. If no data is found, the extension is capitalized and appended with "file", e.g. "ZAP file".

Parameters:
aMIMETypecontent-type to retrieve description for
Returns:
string containing pretty user-readable description of type

Definition at line 35 of file MIMEService.cs.

    {
      RegistryKey clsRoot = Registry.ClassesRoot;
      string extension = GetExtensionForMIMEType(aMIMEType);
      RegistryKey handlerKey = clsRoot.OpenSubKey(extension);
      string handler = handlerKey.GetValue("") as String;
      RegistryKey descriptionKey = clsRoot.OpenSubKey(handler);
      string description = descriptionKey.GetValue("") as String;
      if (description == "")
        description = extension.Substring(1,extension.Length-1).ToUpper() + " file";
      return description;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Retrieves the extension associated with the specified content type by looking up the type in the Windows Registry.

Parameters:
aMIMETypecontent-type to retrieve extension for
Returns:
string containing the extension (".foo") associated with the type

Definition at line 19 of file MIMEService.cs.

    {
      RegistryKey clsRoot = Registry.ClassesRoot;
      string extFromMIMEDBKey = "MIME\\Database\\Content Type\\" + aMIMEType;
      RegistryKey extensionKey = clsRoot.OpenSubKey(extFromMIMEDBKey);
      return extensionKey.GetValue("Extension") as String;
    }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: