Class MediaTypeUtility
Static utility class to help with MediaType queries.
Inheritance
Inherited Members
Namespace: Appearition.Common
Assembly: Appearition.SDK.dll
Syntax
public static class MediaTypeUtility
Methods
View SourceCreateMediaFileFromMediaType(MediaType)
Create a new instance of a MediaFile using a template MediaType.
Declaration
public static MediaFile CreateMediaFileFromMediaType(MediaType mediaType)
Parameters
Type | Name | Description |
---|---|---|
MediaType | mediaType |
Returns
Type | Description |
---|---|
MediaFile |
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, IEnumerable<MediaType>, 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, IEnumerable<MediaType> mediaTypes, bool isGivenStringDisplayName = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | mediaTypeGivenName | Media type given name. |
System.Collections.Generic.IEnumerable<MediaType> | mediaTypes | |
System.Boolean | isGivenStringDisplayName | If set to |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | Lists all extensions from this mediatype. |
FindMediaTypeFromDisplayName(String, IEnumerable<MediaType>)
Fetches the MediaType corresponding to a given display name.
Declaration
public static MediaType FindMediaTypeFromDisplayName(string displayName, IEnumerable<MediaType> mediaTypes)
Parameters
Type | Name | Description |
---|---|---|
System.String | displayName | Display name. |
System.Collections.Generic.IEnumerable<MediaType> | mediaTypes |
Returns
Type | Description |
---|---|
MediaType | The media type from display name. |
FindMediaTypeFromEmsName(String, IEnumerable<MediaType>)
Fetches the MediaType corresponding to a given name as displayed on the EMS.
Declaration
public static MediaType FindMediaTypeFromEmsName(string nameAsOnEms, IEnumerable<MediaType> mediaTypes)
Parameters
Type | Name | Description |
---|---|---|
System.String | nameAsOnEms | Name as on EM. |
System.Collections.Generic.IEnumerable<MediaType> | mediaTypes |
Returns
Type | Description |
---|---|
MediaType | The media type from EMS name. |
FindMediaTypesFromExtension(String, IEnumerable<MediaType>)
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, IEnumerable<MediaType> mediaTypes)
Parameters
Type | Name | Description |
---|---|---|
System.String | extension | Extension. |
System.Collections.Generic.IEnumerable<MediaType> | mediaTypes |
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(IEnumerable<MediaType>)
Returns a list containing the display names of all the active MediaTypes.
Declaration
public static List<string> GetAllMediaTypesByDisplayName(IEnumerable<MediaType> mediaTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<MediaType> | mediaTypes |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The all media types by display name. |
GetAllMediaTypesByNameAsOnEms(IEnumerable<MediaType>)
Returns a list containing the names (as on the EMS) of all the active MediaTypes.
Declaration
public static List<string> GetAllMediaTypesByNameAsOnEms(IEnumerable<MediaType> mediaTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<MediaType> | mediaTypes |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The all media types by name as on EM. |