Class PlayitConnection
- Namespace
- McServerLauncher.Views
- Assembly
- McServerLauncher.dll
Shared "connect your Playit account" flow, used both from the per-server tunnel actions and from the Settings dialog. Encapsulates the setup-code dialog, persisting the resulting agent secret (encrypted) and wiring PlayitApiService, so the user never touches keys or files.
public static class PlayitConnection
- Inheritance
-
PlayitConnection
- Inherited Members
Methods
ConnectAsync(Window, AppSettings, AppSettingsService)
Shows the setup-code dialog, stores the result (encrypted) and wires it. Returns the credential, or null if cancelled.
public static Task<string?> ConnectAsync(Window owner, AppSettings settings, AppSettingsService service)
Parameters
ownerWindowsettingsAppSettingsserviceAppSettingsService
Returns
Credential(AppSettings)
The stored credential (per-user agent key, or a legacy write key), or null if none.
public static string? Credential(AppSettings s)
Parameters
Returns
Disconnect(AppSettings, AppSettingsService)
Clears the stored Playit connection (agent key + any legacy key) and stops the agent.
public static void Disconnect(AppSettings settings, AppSettingsService service)
Parameters
settingsAppSettingsserviceAppSettingsService
EnsureAsync(Window, AppSettings, AppSettingsService)
Returns the stored credential if already connected; otherwise runs the connect flow. Returns null if the user cancels.
public static Task<string?> EnsureAsync(Window owner, AppSettings settings, AppSettingsService service)
Parameters
ownerWindowsettingsAppSettingsserviceAppSettingsService
Returns
IsConnected(AppSettings)
True if the user has connected their Playit account (or has a legacy key).
public static bool IsConnected(AppSettings s)
Parameters
Returns
Sources(AppSettings, Func<string?>?)
Every credential this machine has for Playit, in the order to try them, without repeats.
public static IReadOnlyList<PlayitConnection.Source> Sources(AppSettings settings, Func<string?>? installedKey = null)
Parameters
settingsAppSettingsWhat the connect flow saved.
installedKeyFunc<string>Reads the key from playit.toml; a parameter so a test need not touch the machine.
Returns
Remarks
The tunnels screen used to look only at what had been saved through the connect flow, so
someone who had installed Playit's own agent — and had working tunnels, which the server
cards found by reading playit.toml — saw "not connected" and an empty table. The
installed agent's key is as good a way into the account as any, so it counts.