IAdapter interface
public interface IAdapter The entry point of an adapter: the one public class in its DLL that registers what the adapter brings, such as games it recognises, containers it opens, finders and converters.
At boot the host reads every adapter.toml, orders adapters so each loads after the ones in its needs, and checks the references of every DLL in the code folder. It then loads the DLL named by code into its own collectible load context, finds exactly one public, non-abstract type that implements IAdapter, creates it with its parameterless constructor and calls Register once. Zero or two such types refuse the adapter with a message naming them.
Quake’s adapter registers both editions of the game, then binds its converters to each. Here it’s cut down to two of them:
public sealed class Quake : IAdapter
{
public void Register(AdapterContext context)
{
context.AddGame(new QuakeGame());
context.AddGame(new QuakeRereleaseGame());
foreach (var game in new[] { QuakeGame.Name, QuakeRereleaseGame.Name })
{
context.AddConverter(game, new QuakeMapRecords());
context.AddConverter(game, new QuakeTextureConverter());
}
}
}
- Assembly
- EvilEngine.Conversion
- Commit
- 4ff877b1