AnkiIO 1.0.2
Build, validate, import, and export Anki-compatible decks from .NET
Loading...
Searching...
No Matches
AnkiCompatibilityRegistry.cs
1namespace AnkiIO;
2
25public sealed class AnkiCompatibilityRegistry
26{
27 private readonly List<IAnkiVersionAdapter> adapters = [];
28
35 {
36 }
37
47 {
48 ArgumentNullException.ThrowIfNull(adapter);
49 adapters.Add(adapter);
50 return this;
51 }
52
62 public IAnkiVersionAdapter Resolve(Version version)
63 {
64 ArgumentNullException.ThrowIfNull(version);
65 return adapters.FirstOrDefault(adapter => adapter.Supports(version)) ?? throw new NotSupportedException($"Anki {version} is not supported. Register an IAnkiVersionAdapter after validating its collection, scheduler, and package formats.");
66 }
67
75}
Describes format capabilities verified against the Anki 26.05 release family.
IAnkiVersionAdapter Resolve(Version version)
Returns the highest-precedence registered adapter supporting an Anki application version.
static AnkiCompatibilityRegistry CreateDefault()
Creates a new registry populated with AnkiIO's built-in, evidence-backed adapters.
AnkiCompatibilityRegistry()
Initializes an empty compatibility registry.
AnkiCompatibilityRegistry Add(IAnkiVersionAdapter adapter)
Registers an adapter at the end of the resolution precedence.
Describes collection, scheduler, and package capabilities verified for an Anki version family.