Class Plugins

Namespace
Elegy.PluginSystem.API
Assembly
Elegy.PluginSystem.dll

Elegy plugin system interface.

public static class Plugins
Inheritance
Plugins
Inherited Members

Properties

Applications

public static IReadOnlyCollection<IApplication> Applications { get; }

Property Value

IReadOnlyCollection<IApplication>

All IApplication plugins and below.

GenericPlugins

public static IReadOnlyCollection<IPlugin> GenericPlugins { get; }

Property Value

IReadOnlyCollection<IPlugin>

All plugins except IApplication-based ones.

Methods

GetApplication(string)

Same as GetPlugin, but for application plugins.

public static IApplication? GetApplication(string path)

Parameters

path string

Returns

IApplication

GetPlugin(string)

Obtains a plugin by its path, e.g. engine/plugins/RenderStandard

public static IPlugin? GetPlugin(string path)

Parameters

path string

Returns

IPlugin

Init(LaunchConfig)

public static bool Init(LaunchConfig config)

Parameters

config LaunchConfig

Returns

bool

LoadPlugin(string)

Reads plugin metadata, loads a plugin assembly and returns an instance of the plugin.

public static IPlugin? LoadPlugin(string path)

Parameters

path string

Directory where the plugin is located. "game/plugins/something" will load "game/plugins/something/plugin.json" and load the assembly based on that plugin configuration.

Returns

IPlugin

null if the path is invalid or if it's missing needed files, otherwise returns a valid plugin instance.

PostInit()

public static bool PostInit()

Returns

bool

RegisterDependency(string, Assembly)

Registers a dependency so that plugins can use the same.

public static void RegisterDependency(string name, Assembly assembly)

Parameters

name string
assembly Assembly

RegisterDependency<T>(string)

Registers a dependency so that plugins can use the same.

public static void RegisterDependency<T>(string name)

Parameters

name string

Type Parameters

T

RegisterPlugin(IPlugin, Assembly?, string?, List<string>?)

Registers a plugin.

public static bool RegisterPlugin(IPlugin plugin, Assembly? assembly = null, string? metadataPath = null, List<string>? failedPlugins = null)

Parameters

plugin IPlugin
assembly Assembly
metadataPath string
failedPlugins List<string>

Returns

bool

RegisterPluginCollector(IPluginCollector)

Registers a plugin collector.

public static void RegisterPluginCollector(IPluginCollector collector)

Parameters

collector IPluginCollector

Shutdown()

public static void Shutdown()

StartApps()

public static bool StartApps()

Returns

bool

UnloadApplication(IApplication)

Same as UnloadPlugin(IPlugin) but for application plugins.

public static bool UnloadApplication(IApplication app)

Parameters

app IApplication

Returns

bool

UnloadPlugin(IPlugin)

Unloads a plugin.

public static bool UnloadPlugin(IPlugin plugin)

Parameters

plugin IPlugin

Returns

bool

UnregisterDependency(string)

Unregisters a dependency.

public static bool UnregisterDependency(string name)

Parameters

name string

Returns

bool

UnregisterPluginCollector<TCollector>()

Registers a plugin collector.

public static bool UnregisterPluginCollector<TCollector>() where TCollector : IPluginCollector

Returns

bool

Type Parameters

TCollector