Struct PortraitImageType
- Namespace
- MailFathom.Application.Portraits
- Assembly
- MailFathom.Application.dll
What kind of image a portrait is: one of the two this deployment stores, judged from the octets themselves.
public readonly record struct PortraitImageType : IEquatable<PortraitImageType>
- Implements
- Inherited Members
Remarks
A closed enumeration rather than a C# enum because what a member carries is the media type a response is served under, and an ordinal would mean nothing to the client reading the header. The set is two because two is what a portrait may be: a format nothing here publishes is refused at the boundary rather than stored for a screen that could not draw it.
The kind is read from the octets and never from what the request claimed. A declared content type is a string an uploader wrote, so trusting it would let anything at all be stored under an image's name and served back to a browser as one. What is matched is the signature each format opens with, which is the first thing a decoder reads too.
Being a struct, default is reachable and is not a kind. It reports itself through IsSpecified and refuses to answer for a media type, so nothing undeclared reaches a response header.
Properties
- All
Gets every kind this build stores.
- IsSpecified
Gets whether this value names a published kind rather than the unusable struct default.
- Jpeg
Gets the JPEG portrait kind.
- MediaType
Gets the media type a portrait of this kind is served under.
- Png
Gets the PNG portrait kind.
Methods
- ToString()
Returns the fully qualified type name of this instance.
- TryDetect(ReadOnlySpan<byte>, out PortraitImageType)
Reads what kind of image the octets are, from the signature the format opens with.