Table of Contents

Class SteamAccountHold

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

One campaign client's Steam account for a run (Valheim.Testing.GameSessions.ResolvedEnvironment.SteamAccounts): the lease on it and the optional signed-in check. AcquireAsync(ResolvedEnvironment, string, string, IGameHost, string, TimeSpan?, CancellationToken) leases the account the client names, or the first free one for its host, and refuses at once when another run holds it, naming that holder run; nothing waits. The lease never lapses on a timer (#257): it is held until ReleaseAsync(), which belongs after the client's teardown, or until valheim-test env recover|teardown --run releases it once its client is proven stopped. A release that finds the lease no longer this run's, or cannot be proven, fails. Its text names the account, never a credential or a SteamID.

public sealed class SteamAccountHold
Inheritance
object
SteamAccountHold

Properties

Account

The leased Steam account's name.

public string Account { get; }

Property Value

string

CheckSignedIn

Whether the client's host must be signed in to this account before it starts (always, outside controlled tests).

public bool CheckSignedIn { get; }

Property Value

bool

Client

The campaign client this account is for.

public string Client { get; }

Property Value

string

ClientHost

The profile host the client runs on.

public string ClientHost { get; }

Property Value

string

LeaseHostName

public string LeaseHostName { get; }

Property Value

string

Owner

Who holds the lease, as other runs are told when they are refused.

public string Owner { get; }

Property Value

string

Pool

public string Pool { get; }

Property Value

string

SignedInChecked

Whether CheckSignedInAsync(IGameHost, CancellationToken) found the client's host signed in to this account.

public bool SignedInChecked { get; }

Property Value

bool

Methods

CheckGameIdentity(GameActor)

Confirms the running game's Steam identity against the leased account, including on Unix where preflight reads a remembered login.

public void CheckGameIdentity(GameActor actor)

Parameters

actor GameActor

CheckSignedInAsync(IGameHost, CancellationToken)

The optional signed-in check, on the client's own host: its Steam client must be signed in to this account (the SteamID observed for it). Windows reads the signed-in user from HKCU\Software\Valve\Steam\ActiveProcess\ActiveUser; macOS reads the account Steam last signed in from the host user's loginusers.vdf (its MostRecent user, or with current clients that write no MostRecent, the single newest Timestamp). Another account, none, or a state that cannot be read throws SteamSignedInException: unreadable is refused, never passed. The SteamID is kept in the private prepared profile for the later in-game check, but never written to the run report.

public Task CheckSignedInAsync(IGameHost clientHost, CancellationToken cancellation = default)

Parameters

clientHost IGameHost
cancellation CancellationToken

Returns

Task

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

Record(ScenarioReport)

Records the account's name and pool in the report's provenance under the client's name. Never a credential or SteamID.

public void Record(ScenarioReport report)

Parameters

report ScenarioReport

ReleaseAsync()

After the client's teardown: releases the lease. Only the first call acts. Throws SteamAccountLeaseException when the lease was no longer this run's (Lost: a maintainer released it) or its release cannot be proven (Unknown; the lease is then held until a recovery releases it): a failed teardown.

public Task ReleaseAsync()

Returns

Task

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.