Table of Contents

Class HostInstall

Namespace
Valheim.Testing.GameSessions
Assembly
Valheim.Testing.GameSessions.dll

Reads game installs and their profiles on a host (never copying an install), so a run on another machine keeps the same pins as one here: the runtime manifest, the game build, loader and patchers (InstallPins) and the server's execute bit are all checked against what the host holds, not against a local copy.

public static class HostInstall
Inheritance
object
HostInstall

Methods

CheckPins(InstallPins, HostListing, string)

Pinned: refuses a listing whose game build, loader or patchers are not pinned, naming each that differs. Returns the pins found, for the report.

public static InstallPins CheckPins(InstallPins pinned, HostListing listing, string kind)

Parameters

pinned InstallPins
listing HostListing
kind string

Returns

InstallPins

DetectServer(HostListing)

The dedicated server's platform from the files at the root, as DetectServer(string) decides it for a local runtime.

public static ServerPlatform DetectServer(HostListing listing)

Parameters

listing HostListing

Returns

ServerPlatform

ListAsync(IGameHost, string, TimeSpan, IReadOnlyList<string>?, CancellationToken)

Hashes every regular file under root on the host (links are refused, as WorldFixture refuses them; so is a pattern that passes through a linked directory on the way to a named path). paths limits the listing to those subdirectories and files: relative patterns whose segments are separated by / or </code>, with allowed in a directory, for example _Data/Managed, or at the file name, for example save_backup_auto-*. A pattern that starts with a separator or a drive, or holds an empty segment, one ending in . or a space (.. included) or one starting with . that holds a wildcard, is refused before anything runs on the host. Null lists everything. The patcher entries and executables are always read.

public static Task<HostListing> ListAsync(IGameHost host, string root, TimeSpan timeout, IReadOnlyList<string>? paths = null, CancellationToken cancellation = default)

Parameters

host IGameHost
root string
timeout TimeSpan
paths IReadOnlyList<string>
cancellation CancellationToken

Returns

Task<HostListing>

Pins(HostListing)

The InstallPins of a listing that covers Valheim.Testing.Game.InstallPins.PinPaths.

public static InstallPins Pins(HostListing listing)

Parameters

listing HostListing

Returns

InstallPins

RequirePortFreeAsync(IGameHost, int, TimeSpan, CancellationToken)

Refuses when anything on the host listens on TCP port (any address), so a command can never reach a process this run does not own. Bash reads /proc/net/tcp (Linux) or netstat's listeners (macOS); PowerShell asks .NET for the active listeners.

public static Task RequirePortFreeAsync(IGameHost host, int port, TimeSpan timeout, CancellationToken cancellation = default)

Parameters

host IGameHost
port int
timeout TimeSpan
cancellation CancellationToken

Returns

Task

RequireSame(IReadOnlyDictionary<string, string>, HostListing, string, IEnumerable<string>?)

Refuses a listing that is not exactly expected (a manifest, / or </code> separators): a missing file, an extra one or a different hash. ignore names files the listing may hold beyond it.

public static void RequireSame(IReadOnlyDictionary<string, string> expected, HostListing listing, string what, IEnumerable<string>? ignore = null)

Parameters

expected IReadOnlyDictionary<string, string>
listing HostListing
what string
ignore IEnumerable<string>