Table of Contents

Method TryDetect

Namespace
MailFathom.Application.Portraits
Assembly
MailFathom.Application.dll

TryDetect(ReadOnlySpan<byte>, out PortraitImageType)

Reads what kind of image the octets are, from the signature the format opens with.

public static bool TryDetect(ReadOnlySpan<byte> content, out PortraitImageType type)

Parameters

content ReadOnlySpan<byte>

The octets as they were supplied.

type PortraitImageType

The kind the octets are, or the struct default when they are neither.

Returns

bool

true when the octets open as a kind this build stores.

Remarks

The signature is the whole of the check, deliberately: nothing here decodes an image, so a file that opens as a JPEG and is damaged after its first octets is stored and served as the person supplied it. What the check is for is that a portrait is an image at all rather than a script or an archive wearing an image's content type.