Class MediaTypeHandler
Static class in charge of containing any definition regarding MediaType, as well as providing utilities to make MediaTypes easier to work with.
Inherited Members
Namespace: Appearition.Common
Assembly: Appearition.SDK.dll
Syntax
public class MediaTypeHandler : BaseHandler
Properties
ActiveMediaTypes
Contains all the MediaTypes loaded and in use.
Declaration
public static List<MediaType> ActiveMediaTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<MediaType> | The active media types. |
ModuleVersion
Declaration
public static string ModuleVersion { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
FindAllExtensionsFromMediaType(MediaType, List<String>)
For a given MediaType, fetches all the associated extensions, with the dot before the extension. Can provide a list which will be filled with those new values.
Declaration
public static List<string> FindAllExtensionsFromMediaType(MediaType mediaType, List<string> allExtensionsContainer = null)
Parameters
Type | Name | Description |
---|---|---|
MediaType | mediaType | Media type. |
System.Collections.Generic.List<System.String> | allExtensionsContainer | All extensions container. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The all extensions from media type. |
FindAllExtensionsFromMediaType(String, Boolean)
Given a name, whether it's the name as on the EMS or a display name, fetches all the extensions for this MediaType. By default, the given name is the display name.
Declaration
public static List<string> FindAllExtensionsFromMediaType(string mediaTypeGivenName, bool isGivenStringDisplayName = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | mediaTypeGivenName | Media type given name. |
System.Boolean | isGivenStringDisplayName | If set to |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | Lists all extensions from this mediatype. |
FindMediaTypeFromDisplayName(String)
Fetches the MediaType corresponding to a given display name.
Declaration
public static MediaType FindMediaTypeFromDisplayName(string displayName)
Parameters
Type | Name | Description |
---|---|---|
System.String | displayName | Display name. |
Returns
Type | Description |
---|---|
MediaType | The media type from display name. |
FindMediaTypeFromEmsName(String)
Fetches the MediaType corresponding to a given name as displayed on the EMS.
Declaration
public static MediaType FindMediaTypeFromEmsName(string nameAsOnEms)
Parameters
Type | Name | Description |
---|---|---|
System.String | nameAsOnEms | Name as on EM. |
Returns
Type | Description |
---|---|
MediaType | The media type from EMS name. |
FindMediaTypesFromExtension(String)
From a given extension (which includes the dot, ie ".png"), fetches all MediaTypes that allow that extension.
Declaration
public static List<MediaType> FindMediaTypesFromExtension(string extension)
Parameters
Type | Name | Description |
---|---|---|
System.String | extension | Extension. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<MediaType> | The media types from extension. |
FindMimeTypeFromExtension(MediaType, String)
From a given MediaType and an extension, finds the MimeType as on the EMS.
Declaration
public static string FindMimeTypeFromExtension(MediaType mediaType, string extension)
Parameters
Type | Name | Description |
---|---|---|
MediaType | mediaType | Media type. |
System.String | extension | Extension. |
Returns
Type | Description |
---|---|
System.String | The MIME type from extension. |
GetAllMediaTypesByDisplayName()
Returns a list containing the display names of all the active MediaTypes.
Declaration
public static List<string> GetAllMediaTypesByDisplayName()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The all media types by display name. |
GetAllMediaTypesByNameAsOnEms()
Returns a list containing the names (as on the EMS) of all the active MediaTypes.
Declaration
public static List<string> GetAllMediaTypesByNameAsOnEms()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The all media types by name as on EM. |
RefreshMediaTypes(Action<List<MediaType>>)
Updates the list of all the MediaTypes that can be used
Declaration
public static void RefreshMediaTypes(Action<List<MediaType>> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Collections.Generic.List<MediaType>> | callback |