Registers version adapters in precedence order and resolves verified capabilities for an Anki version. More...
Public Member Functions | |
| AnkiCompatibilityRegistry () | |
| Initializes an empty compatibility registry. | |
| AnkiCompatibilityRegistry | Add (IAnkiVersionAdapter adapter) |
| Registers an adapter at the end of the resolution precedence. | |
| IAnkiVersionAdapter | Resolve (Version version) |
| Returns the highest-precedence registered adapter supporting an Anki application version. | |
Static Public Member Functions | |
| static AnkiCompatibilityRegistry | CreateDefault () |
| Creates a new registry populated with AnkiIO's built-in, evidence-backed adapters. | |
Registers version adapters in precedence order and resolves verified capabilities for an Anki version.
Resolution returns the first adapter whose IAnkiVersionAdapter.Supports method succeeds. Register narrow or application-specific adapters before broad fallbacks. CreateDefault places built-in adapters first, so adapters appended to that result do not override a built-in match; create an empty registry to choose custom-first precedence explicitly.
Registries are mutable configuration objects and are not safe for concurrent registration and resolution. Adapters may overlap and may be added more than once; ordering, rather than deduplication, defines the outcome. Each default registry and each built-in adapter instance is independent, while its capability sets remain immutable.
Definition at line 25 of file AnkiCompatibilityRegistry.cs.
|
inline |
Initializes an empty compatibility registry.
Add adapters from highest to lowest precedence. Use CreateDefault when built-in, evidence-backed adapters should be registered automatically.
Definition at line 34 of file AnkiCompatibilityRegistry.cs.
|
inline |
Registers an adapter at the end of the resolution precedence.
| adapter | The compatibility adapter to register. |
Duplicate instances and overlapping ranges are permitted. If several adapters support a version, Resolve returns the one registered earliest.
| ArgumentNullException | adapter is null. |
Definition at line 46 of file AnkiCompatibilityRegistry.cs.
|
inlinestatic |
Creates a new registry populated with AnkiIO's built-in, evidence-backed adapters.
Each call returns an independent registry. Additions to one result do not affect later results. Appended adapters have lower precedence than the built-ins already present.
Definition at line 74 of file AnkiCompatibilityRegistry.cs.
|
inline |
Returns the highest-precedence registered adapter supporting an Anki application version.
| version | The parsed Anki application version to resolve. |
This is a metadata lookup only. It neither detects Anki nor opens a package or collection. An unsupported result is explicit rather than silently selecting the nearest release family.
| ArgumentNullException | version is null. |
| NotSupportedException | No registered adapter supports version . |
Definition at line 62 of file AnkiCompatibilityRegistry.cs.