# Externals class

> Every External a probe declared, resolved, in the order it declared them. The host hands it to Open, and the open mount keeps it. Look one up by name and check that it resolved before reading its files.

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

```csharp
public sealed class Externals : IReadOnlyList<ResolvedExternal>
```

Every [External](/docs/api/external) a probe declared, resolved, in the order it declared them. The host hands it to [Open](/docs/api/igameadapter#open), and the open mount keeps it. Look one up by name and check that it resolved before reading its files.

```csharp
if (externals[Steamapps.Name] is not { IsResolved: true, Files: { } steamapps, Location: { } library } ||
    externals[Depotcache.Name] is not { IsResolved: true, Files: { } depotcache })
    return claims;
```

The host resolves each external in turn. The pointer's `[externals]` table comes first, by the external's name, unless the game's own config [switches](/docs/api/external#gameswitches) it: a path there is used as it is, and `false` turns it off. Then an external that's off by default stays off. A game external takes an open mount that fits, or opens a probe on offer that fits. Last comes the external's [hint](/docs/api/externalhint), and with none it's missing. A path is used only when it's absolute and there: a folder is read as it is, a file through the container adapter that recognises it, and for a game external the path is probed. Every answer is a [ResolvedExternal](/docs/api/resolvedexternal) saying where it came from, so nothing missing throws.

## Members

### Externals (constructor)

```csharp
public Externals(IEnumerable<ResolvedExternal> entries, IEnumerable<string>? unknown = null)
```

Makes a set from resolved externals and the names in the pointer that matched none. The host makes these. Tests and code calling [Open](/docs/api/igameadapter#open) by hand make their own, or use [None](#none).

### None (property)

```csharp
public static Externals None { get; }
```

A set with no externals, no unknown names and no key.

### Unknown (property)

```csharp
public IReadOnlyList<string> Unknown { get; }
```

Names in the pointer's `[externals]` table that the game doesn't declare, and that aren't under one that [TakesChildren](/docs/api/external#takeschildren), in ordinal order. They're left out, and `just mounts` prints each as one the game doesn't declare.

### Key (property)

```csharp
public MountKey? Key { get; init; }
```

The [MountKey](/docs/api/mountkey) read from the file the pointer's `key` names, or `null` when it names none. It's read whatever the probe's status, and holds a problem rather than bytes when it couldn't be read.

### this (property)

```csharp
public ResolvedExternal? this[string name] { get; }
```

```csharp
public ResolvedExternal this[int index] { get; }
```

The resolved external with that name, or `null` when the probe declared none by it. Names match exactly. With an index, the external at that place in the probe's order, which throws `IndexOutOfRangeException` outside [Count](#count).

### Count (property)

```csharp
public int Count { get; }
```

How many externals the probe declared.

### GetEnumerator (method)

```csharp
public IEnumerator<ResolvedExternal> GetEnumerator()
```

Goes through the resolved externals in the probe's order.
