Table of Contents

Class DocumentFormatRegistry

Namespace
DocWright.Core.Formats
Assembly
DocWright.Core.dll

An instance-scoped registry of document readers and writers, keyed by format name and file extension. New formats plug in by registering an IDocumentReader or IDocumentWriter — the core contracts never widen for a new format.

public sealed class DocumentFormatRegistry
Inheritance
DocumentFormatRegistry
Inherited Members

Remarks

Thread-safe: registration and lookup may run concurrently. Typical hosts register all formats at startup and only read afterwards.

Constructors

DocumentFormatRegistry()

Methods

AddReader(IDocumentReader)

Registers a reader. Registration order is the probe order used by TryDetectReader(Stream, out IDocumentReader?).

AddWriter(IDocumentWriter)

Registers a writer.

GetReaders()

Returns a snapshot of the registered readers, in registration order.

GetWriters()

Returns a snapshot of the registered writers, in registration order.

TryDetectReader(Stream, out IDocumentReader?)

Detects the reader for a stream by asking each registered reader to sniff it, in registration order. The stream position is restored after every probe.

TryGetReaderForExtension(string, out IDocumentReader?)

Finds the reader registered for a file extension.

TryGetWriterForExtension(string, out IDocumentWriter?)

Finds the writer registered for a file extension.