# IAdapter interface

> 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.

Namespace `EvilEngine.Conversion`, assembly `EvilEngine.Conversion`. Engine commit 4ff877b1.

```csharp
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](#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:

```csharp
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());
        }
    }
}
```

## Members

### Register (method)

```csharp
void Register(AdapterContext context)
```

Called once at boot with this adapter's [AdapterContext](/docs/api/adaptercontext). Register everything here. It runs during the boot, after the adapters in your `needs` have registered and before any pointer is probed.

An adapter with nothing to register, like `pc`, which only holds the PC platform for other adapters to use, can leave it empty.

If it throws, the boot notes `failed to load` with the exception's message and the adapter isn't listed as loaded. Whatever it registered before the throw stays registered.
