LANCommander/LANCommander.Documentation/Plugins/API Reference.md
2026-07-28 19:44:59 -05:00

14 KiB

title sidebar_label sidebar_position
API Reference API Reference 4

{/* This file is generated by LANCommander.PluginDocsGenerator. Do not edit by hand. /} {/ Regenerate with: dotnet run --project LANCommander.PluginDocsGenerator */}

Plugin API Reference

This reference is generated directly from the plugin contract assemblies and their XML documentation comments, so it always reflects the extension surface of the installed version. Types are grouped by namespace. Interfaces you implement in a plugin are listed first within each group.

LANCommander.SDK.Plugins

IPlugin

interfaceLANCommander.SDK.Plugins.IPlugin

The entry point contract every LANCommander plugin implements. Plugins are discovered from the host's Plugins drop-in folder and loaded once at startup.

Properties

  • string Id { get; }
    • Stable, globally unique identifier (e.g. "com.acme.myplugin").
  • string Name { get; }
    • Human readable display name.
  • string Version { get; }
    • Plugin version (SemVer recommended).
  • string Author { get; }
    • Plugin author.

Methods

  • void ConfigureServices(IServiceCollection services)
    • Registers the plugin's own services into the host's DI container. Called during host startup before the service provider is built, so implementations must only register services and must not attempt to resolve them.
  • Task InitializeAsync(PluginContext context, CancellationToken cancellationToken)
    • Asynchronous startup hook, invoked after the host's service provider is built. Use this to resolve services, subscribe to lifecycle events, register UI extensions, etc.

IPluginEventBus

interfaceLANCommander.SDK.Plugins.IPluginEventBus

A minimal in-process, strongly-typed event aggregator that lets plugins react to host lifecycle events (game install/launch/uninstall, login, etc.). Registered as a singleton in both hosts.

Methods

  • IDisposable Subscribe<TEvent>(Func<TEvent, CancellationToken, Task> handler)
    • Subscribes a handler to events of type TEvent.
  • Task PublishAsync<TEvent>(TEvent event, CancellationToken cancellationToken)
    • Publishes an event to all subscribed handlers. Each handler is awaited and isolated so a throwing handler cannot break the publisher or other handlers.

IPluginPowerShellExtension

interfaceLANCommander.SDK.Plugins.IPluginPowerShellExtension

Implemented by plugins that want to add PowerShell cmdlets or script modules into the LANCommander runspace. Register the implementation in ConfigureServices; the SDK's PowerShell runspace picks up all registered extensions when a script is executed.

Methods

  • IEnumerable<Type> GetCmdletTypes()
    • Returns cmdlet types (classes decorated with [Cmdlet]) to register into each runspace.
  • IEnumerable<string> GetModulePaths()
    • Returns absolute paths to PowerShell script modules (.psm1/.psd1) shipped with the plugin that should be imported into each runspace.

LANCommanderPluginAttribute

attributeLANCommander.SDK.Plugins.LANCommanderPluginAttribute

Assembly-level attribute that marks an assembly as a LANCommander plugin and declares its entry point and compatibility metadata. This is the primary discovery mechanism used by the loader.

Properties

  • Type EntryPoint { get; }
    • The concrete type implementing IPlugin that serves as the entry point.
  • string Id { get; set; }
    • Optional override for the plugin id; when null the loader falls back to the instance's Id.
  • string MinHostVersion { get; set; }
    • Minimum compatible host (SDK) version, inclusive. Null means no lower bound.
  • string MaxHostVersion { get; set; }
    • Maximum compatible host (SDK) version, inclusive. Null means no upper bound.
  • PluginHost Hosts { get; set; }
    • The hosts this plugin supports. Defaults to both server and launcher.

PluginBootstrap

classLANCommander.SDK.Plugins.PluginBootstrap

Convenience helper that centralizes plugin discovery so every host wires it identically. Call ConfigurePlugins as the last step while populating the service collection (before building the provider), then call InitializeAllAsync on the returned loader after the provider is built.

Methods

  • PluginLoaderService ConfigurePlugins(IServiceCollection services, PluginHost host)
    • Discovers plugins for host from <config>/Plugins, lets each register its services into services, and registers the loader as a singleton so the same instance can drive Phase 2 initialization.

PluginContext

classLANCommander.SDK.Plugins.PluginContext

Runtime context handed to a plugin during InitializeAsync.

Properties

  • PluginHost Host { get; init; }
    • The host the plugin is running inside (a single value, never a flags combination).
  • IServiceProvider Services { get; init; }
    • The fully built host service provider (scoped per plugin during initialization).
  • string PluginDirectory { get; init; }
    • Absolute path to the folder the plugin was loaded from.
  • ILogger Logger { get; init; }
    • Logger scoped to the plugin.

PluginEventBus

classLANCommander.SDK.Plugins.PluginEventBus

Methods

  • IDisposable Subscribe<TEvent>(Func<TEvent, CancellationToken, Task> handler)
  • Task PublishAsync<TEvent>(TEvent event, CancellationToken cancellationToken)

PluginLoadContext

classLANCommander.SDK.Plugins.PluginLoadContext

An isolated AssemblyLoadContext for a single plugin. Uses an AssemblyDependencyResolver to resolve the plugin's private dependencies while deferring host-provided assemblies (the SDK, DI abstractions, Avalonia, etc.) to the default context so that shared types keep a single identity across the ALC boundary.

PluginLoaderService

classLANCommander.SDK.Plugins.PluginLoaderService

Discovers, loads, and initializes plugins from a drop-in folder. Split into two phases to match the "build the DI container once" constraint: DiscoverAndConfigure runs while the host is still populating its IServiceCollection (before the provider is built).InitializeAllAsync runs after the provider has been built.

Properties

  • IReadOnlyList<PluginManifest> LoadedPlugins { get; }
    • Plugins successfully loaded and configured during discovery.

Methods

  • void DiscoverAndConfigure(IServiceCollection services, PluginHost host, string pluginsRoot, string hostVersion, ILogger logger)
    • Phase 1: scans pluginsRoot for plugins, loads each into its own PluginLoadContext, applies host + version gates, instantiates the entry point, and lets it register services. A failure in one plugin never aborts the batch.
  • Task InitializeAllAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken)
    • Phase 2: invokes InitializeAsync for every loaded plugin, each within its own DI scope. A failure in one plugin never aborts the others.

PluginManifest

classLANCommander.SDK.Plugins.PluginManifest

Parsed metadata describing a discovered plugin, derived from its LANCommanderPluginAttribute.

Properties

  • string Id { get; init; }
  • Type EntryPoint { get; init; }
  • string MinHostVersion { get; init; }
  • string MaxHostVersion { get; init; }
  • PluginHost Hosts { get; init; }
  • Assembly Assembly { get; init; }
    • The assembly the plugin was loaded from.
  • string Directory { get; init; }
    • Absolute path to the folder the plugin was loaded from.

Methods

  • PluginManifest FromAttribute(LANCommanderPluginAttribute attribute, Assembly assembly, string directory)
    • Builds a manifest from an assembly-level plugin attribute.

PluginHost

enumLANCommander.SDK.Plugins.PluginHost

Identifies which LANCommander host a plugin targets. Used both as a single value (the host a plugin is being loaded into) and as a flags set (the hosts a plugin declares support for).

Value Description
None = 0
Server = 1
Launcher = 2

LANCommander.SDK.Plugins.Events

GameAfterExitEvent

recordLANCommander.SDK.Plugins.Events.GameAfterExitEvent

Raised immediately after a launched game process exits.

Properties

  • Guid GameId { get; init; }
  • string InstallDirectory { get; init; }

GameBeforeLaunchEvent

recordLANCommander.SDK.Plugins.Events.GameBeforeLaunchEvent

Raised immediately before a game's executable is launched.

Properties

  • Guid GameId { get; init; }
  • string InstallDirectory { get; init; }
  • string Action { get; init; }

GameInstallFailedEvent

recordLANCommander.SDK.Plugins.Events.GameInstallFailedEvent

Raised when a game install fails.

Properties

  • Guid GameId { get; init; }
  • string InstallDirectory { get; init; }

GameInstalledEvent

recordLANCommander.SDK.Plugins.Events.GameInstalledEvent

Raised after a game has finished installing.

Properties

  • Guid GameId { get; init; }
  • string InstallDirectory { get; init; }

GameInstallingEvent

recordLANCommander.SDK.Plugins.Events.GameInstallingEvent

Raised just before a game install begins.

Properties

  • Guid GameId { get; init; }
  • string InstallDirectory { get; init; }

GameUninstalledEvent

recordLANCommander.SDK.Plugins.Events.GameUninstalledEvent

Raised after a game has finished uninstalling.

Properties

  • Guid GameId { get; init; }

GameUninstallingEvent

recordLANCommander.SDK.Plugins.Events.GameUninstallingEvent

Raised just before a game is uninstalled.

Properties

  • Guid GameId { get; init; }
  • string InstallDirectory { get; init; }

InstallQueueChangedEvent

recordLANCommander.SDK.Plugins.Events.InstallQueueChangedEvent

Raised whenever the install/download queue changes.

UserLoggedInEvent

recordLANCommander.SDK.Plugins.Events.UserLoggedInEvent

Raised after a user successfully logs in.

Properties

  • Guid UserId { get; init; }
  • string UserName { get; init; }

UserLoggedOutEvent

recordLANCommander.SDK.Plugins.Events.UserLoggedOutEvent

Raised after a user logs out.

Properties

  • Guid UserId { get; init; }
  • string UserName { get; init; }

LANCommander.Launcher.Plugins.Extensions

IContextMenuExtension

interfaceLANCommander.Launcher.Plugins.Extensions.IContextMenuExtension

Adds items to a game's context menu. Implementations are resolved from DI and their items appended to the consolidated game menu shown on covers and list rows.

Properties

  • int Order { get; }
    • Relative position among extension items; lower values appear first.

Methods

  • IEnumerable<Control> BuildMenuItems(Guid gameId)
    • Builds the menu items shown for the given game (typically MenuItems).

IFooterExtension

interfaceLANCommander.Launcher.Plugins.Extensions.IFooterExtension

Adds a control to the launcher shell's footer. Implementations are resolved from DI and rendered, ordered by Order, alongside the built-in footer items.

Properties

  • int Order { get; }
    • Relative position among extension items; lower values appear first.

Methods

  • Control BuildContent()
    • Builds the control rendered in the footer.

IGameDetailTabExtension

interfaceLANCommander.Launcher.Plugins.Extensions.IGameDetailTabExtension

Adds an additional tab to a game's detail view. Implementations are resolved from DI and appended, ordered by Order, after the built-in tabs.

Properties

  • string Header { get; }
    • Header shown on the tab.
  • int Order { get; }
    • Relative position among extension tabs; lower values appear first.

Methods

  • Control BuildContent(Guid gameId)
    • Builds the control rendered inside the tab for the given game.

INavigationPageExtension

interfaceLANCommander.Launcher.Plugins.Extensions.INavigationPageExtension

Adds a top-level navigable destination reachable from the launcher shell. The view model is registered with the IViewRegistry so the shell's content control can render the associated view when navigated to.

Properties

  • string Label { get; }
    • Label shown for the navigation entry.
  • int Order { get; }
    • Relative position among extension destinations; lower values appear first.
  • Type ViewModelType { get; }
    • The view model type used both as the navigation target and the registry key.

Methods

  • PluginViewModelBase CreateViewModel()
    • Creates the view model instance shown when the destination is activated.
  • Control BuildView()
    • Builds the control that renders ViewModelType.

ISettingsPageExtension

interfaceLANCommander.Launcher.Plugins.Extensions.ISettingsPageExtension

Adds an additional section to the launcher's settings page. Implementations are resolved from DI and appended, ordered by Order, beneath the built-in settings sections.

Properties

  • string Title { get; }
    • Heading shown for the section.
  • int Order { get; }
    • Relative position among extension sections; lower values appear first.

Methods

  • Control BuildContent()
    • Builds the control rendered inside the section.

LANCommander.Launcher.Plugins

IViewRegistry

interfaceLANCommander.Launcher.Plugins.IViewRegistry

Maps view model types to the Avalonia controls that render them. Seeded at startup with the launcher's built-in mappings and extended at runtime by plugins that add navigable views. Consumers apply AsDataTemplate to a ContentControl so content is resolved by view model type, replacing the previously hard-coded inline XAML data templates.

Methods

  • void Register(Type viewModelType, Func<Control> factory)
    • Register a control factory for the given view model type.
  • void Register<TViewModel>(Func<Control> factory)
    • Register a control factory for TViewModel.
  • IDataTemplate AsDataTemplate()
    • Build an IDataTemplate backed by the current registrations. Matching prefers the most-derived registered type, preserving the launcher's existing rule that DepotGameDetailViewModel resolves before its GameDetailViewModel base.

PluginViewModelBase

classLANCommander.Launcher.Plugins.PluginViewModelBase

Base type for view models supplied by plugins. Lives in this project (rather than the launcher's ViewModels assembly) so plugins can derive from it without taking a dependency on the launcher application itself, avoiding a circular reference.

ViewRegistry

classLANCommander.Launcher.Plugins.ViewRegistry

Methods

  • void Register(Type viewModelType, Func<Control> factory)
  • void Register<TViewModel>(Func<Control> factory)
  • IDataTemplate AsDataTemplate()