Table of Contents

Class PlayitAgentRunner

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Runs Playit's official agent (playitd) as a child process so the user's tunnels actually forward traffic — without them installing anything. The binary is downloaded once (pinned to the same version the app registers, McServerLauncher.Services.PlayitAgentRunner.AgentVersion) and launched with --secret-path (see McServerLauncher.Services.PlayitAgentRunner.SecretPath) pointing at the per-user agent key from the setup-code flow. One agent serves all of the user's tunnels; it runs while the app is open and connected, and is stopped on shutdown. App-wide singleton.

public class PlayitAgentRunner
Inheritance
PlayitAgentRunner
Inherited Members

Fields

VersionMajor

public const int VersionMajor = 1

Field Value

int

VersionMinor

public const int VersionMinor = 0

Field Value

int

VersionPatch

public const int VersionPatch = 10

Field Value

int

Properties

HasSecret

True once the app has an agent key to run (i.e. the user connected their Playit account).

public bool HasSecret { get; }

Property Value

bool

LastError

Human-readable reason for the last Failed (for the UI).

public string? LastError { get; }

Property Value

string

PlatformSupported

True if the embedded agent can run on this platform.

public bool PlatformSupported { get; }

Property Value

bool

Shared

public static PlayitAgentRunner Shared { get; }

Property Value

PlayitAgentRunner

State

public AgentRunState State { get; }

Property Value

AgentRunState

Methods

RetryAsync()

(Re)starts the agent with the last known secret. No-op if we never had one.

public Task RetryAsync()

Returns

Task

StartAsync(string)

Ensures the agent binary is present (downloading it once) and runs it with the given secret. No-op if already running with the same secret. Safe to call repeatedly.

public Task StartAsync(string secretKey)

Parameters

secretKey string

Returns

Task

Stop()

Stops the agent process (called on app shutdown or disconnect).

public void Stop()

Events

StateChanged

Raised when State changes.

public event Action<AgentRunState>? StateChanged

Event Type

Action<AgentRunState>