Skip to content

Media Classes

TypNull edited this page May 8, 2024 · 1 revision

Summary

FileMetadata Class

Class to build a file metadata.

Properties:

  • FileName: Type: string
    • Gets the name of the file.
  • Extension: Type: string
    • Gets the extension of the file.

Methods:

  • SetExtension: Type: void
    • Sets the extension of a request file based on the content type or the URI.
  • SetFilename: Type: void
    • Generates the filename from the header or the URI.
  • BuildFilename: Type: string
    • Builds the filename based on the preset filename or the generated filename.
  • static RemoveInvalidFileNameChars: Type: string
    • Removes all invalid characters for a filename out of a string.

MediaType Enum

Enum representing the media type of a web file.

Values:

  • NoMedia: Represents a non-media file.
  • Video: Represents video and movie files, such as .mp4 or .avi.
  • Audio: Represents audio and music files, such as .mp3 or .wav.
  • Application: Represents binary data that require an application to interpret, such as .exe or .dll.
  • Text: Represents readable text files, such as .txt or .docx.
  • Image: Represents graphical data formats, such as .jpg or .png.
  • Font: Represents font or typeface files, such as .ttf or .otf.
  • Model: Represents model data used to create 2D or 3D scenes, such as .obj or .fbx.
  • Multipart: Represents data with multiple media types, such as .html or .xml.
  • Message: Represents email and messaging formats, such as .eml or .msg.
  • Unknown: Represents a media type that is unknown or not recognized.

MimeTypeMap Class

A static class that maps MIME types to file extensions and vice versa.

Methods:

  • GetDefaultExtension: Type: string
    • Gets the default file extension for a given MIME type.
  • static TryGetMimeType: Type: bool
    • Tries to get the MIME type for a given file name or extension.
  • static GetMimeType: Type: string
    • Gets the MIME type for a given file name or extension.
  • static GetExtension: Type: string
    • Gets the file extension for a given MIME type.

WebItem Record

This record represents a web item with information about a file.

Properties:

  • Description: Type: string
    • Gets or sets the description of the web item.
  • URL: Type: Uri
    • Gets or sets the URL of the web item.
  • Title: Type: string
    • Gets or sets the title of the web item.
  • Type: Type: WebType
    • Gets or sets the type of the web item.

Methods:

  • CreateLoadRequest: Type: GetRequest
    • Creates a GetRequest from this web item. The options for the request can be provided as an argument.
  • CreateStatusRequest: Type: StatusRequest
    • Creates a StatusRequest to check if the file is available. The options for the request can be provided as an argument.

WebType Record

This record represents the type of a WebItem.

Properties:

  • MediaType: Type: MediaType
    • This property gets the media type of this instance.
  • Extension: Type: string
    • This property gets the file extension associated with this type.
  • Raw: Type: string
    • This property gets the raw string representation of this type.
  • FullType: Type: string
    • This property gets the full type, including the main and sub parts.
  • IsMedia: Type: bool
    • This property gets a value indicating whether this type represents a media file.
  • IsLink: Type: bool
    • This property gets a value indicating whether this type represents a link.
  • IsApplication: Type: bool
    • This property gets a value indicating whether this type represents an application file.
  • IsFont: Type: bool
    • This property gets a value indicating whether this type represents a font file.
  • IsImage: Type: bool
    • This property gets a value indicating whether this type represents an image file.
  • IsMessage: Type: bool
    • This property gets a value indicating whether this type represents a message file.
  • IsModel: Type: bool
    • This property gets a value indicating whether this type represents a model.
  • IsMultipart: Type: bool
    • This property gets a value indicating whether this type represents a multipart file.
  • IsText: Type: bool
    • This property gets a value indicating whether this type represents a text file.
  • IsAudio: Type: bool
    • This property gets a value indicating whether this type represents an audio file.
  • IsVideo: Type: bool
    • This property gets a value indicating whether this type represents a video file.
  • IsUnknown: Type: bool
    • This property gets a value indicating whether the MediaType is unknown.

Methods:

  • WebType: Type: void
    • This method initializes a new instance of the WebType class. The raw text type to parse is passed as a parameter.
  • private Convert: Type: void
    • This method converts the raw media type into a MediaType and determines the file extension.