Table of Contents

Class Plugin

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

Represents a plugin

public class Plugin : CorePropertyChanged, IDisposable
Inheritance
object
CorePropertyChanged
Plugin
Implements

Properties

Assembly

The assembly the plugin code lives in

public Assembly? Assembly { get; }

Property Value

Assembly

Bootstrapper

Gets the plugin bootstrapper

public PluginBootstrapper? Bootstrapper { get; }

Property Value

PluginBootstrapper

ConfigurationDialog

Gets or sets a configuration dialog for this plugin that is accessible in the UI under Settings > Plugins

public IPluginConfigurationDialog? ConfigurationDialog { get; set; }

Property Value

IPluginConfigurationDialog

Container

Gets the IOC container of the plugin, only use this for advanced IOC operations, otherwise see Resolve(Type, params object?[]) and Resolve<T>(params object?[])

public IContainer? Container { get; }

Property Value

IContainer

Directory

The plugins root directory

public DirectoryInfo Directory { get; }

Property Value

DirectoryInfo

Features

Gets a read-only collection of all features this plugin provides

public ReadOnlyCollection<PluginFeatureInfo> Features { get; }

Property Value

ReadOnlyCollection<PluginFeatureInfo>

Guid

Gets the plugin GUID

public Guid Guid { get; }

Property Value

Guid

Info

Gets the plugin info related to this plugin

public PluginInfo Info { get; }

Property Value

PluginInfo

IsEnabled

Indicates whether the user enabled the plugin or not

public bool IsEnabled { get; }

Property Value

bool

Profilers

Gets a read-only collection of profiles running on the plugin

public ReadOnlyCollection<Profiler> Profilers { get; }

Property Value

ReadOnlyCollection<Profiler>

Methods

Dispose()

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

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the object and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetFeatureInfo<T>()

Looks up the feature info the feature of type T

public PluginFeatureInfo GetFeatureInfo<T>() where T : PluginFeature

Returns

PluginFeatureInfo

Feature info of the feature

Type Parameters

T

The type of feature to find

GetFeature<T>()

Looks up the instance of the feature of type T

public T? GetFeature<T>() where T : PluginFeature

Returns

T

If found, the instance of the feature

Type Parameters

T

The type of feature to find

GetProfiler(string)

Gets a profiler with the provided name, if it does not yet exist it will be created.

public Profiler GetProfiler(string name)

Parameters

name string

The name of the profiler

Returns

Profiler

A new or existing profiler with the provided name

OnDisabled()

Invokes the Disabled event

protected virtual void OnDisabled()

OnEnabled()

Invokes the Enabled event

protected virtual void OnEnabled()

OnFeatureAdded(PluginFeatureInfoEventArgs)

Invokes the FeatureAdded event

protected virtual void OnFeatureAdded(PluginFeatureInfoEventArgs e)

Parameters

e PluginFeatureInfoEventArgs

OnFeatureRemoved(PluginFeatureInfoEventArgs)

Invokes the FeatureRemoved event

protected virtual void OnFeatureRemoved(PluginFeatureInfoEventArgs e)

Parameters

e PluginFeatureInfoEventArgs

Register<TImplementation>(PluginServiceScope)

Registers implementation type TImplementation with itself as service type.

public void Register<TImplementation>(PluginServiceScope scope = PluginServiceScope.Singleton)

Parameters

scope PluginServiceScope

The scope in which the service should live, if you are not sure leave it on singleton.

Type Parameters

TImplementation

The implementation of the service to register.

Register<TService, TImplementation>(PluginServiceScope)

Registers service of TService type implemented by TImplementation type.

public void Register<TService, TImplementation>(PluginServiceScope scope = PluginServiceScope.Singleton) where TImplementation : TService

Parameters

scope PluginServiceScope

The scope in which the service should live, if you are not sure leave it on singleton.

Type Parameters

TService

The service to register.

TImplementation

The implementation of the service to register.

RemoveProfiler(Profiler)

Removes a profiler from the plugin

public void RemoveProfiler(Profiler profiler)

Parameters

profiler Profiler

The profiler to remove

Resolve(Type, params object?[])

Gets an instance of the specified service using the plugins dependency injection container.

public object Resolve(Type type, params object?[] arguments)

Parameters

type Type

The type of service to resolve.

arguments object[]

Arguments to supply to the service.

Returns

object

An instance of the service.

See Also

ResolveRelativePath(string?)

Resolves the relative path provided in the path parameter to an absolute path

public string? ResolveRelativePath(string? path)

Parameters

path string

The path to resolve

Returns

string

An absolute path pointing to the provided relative path

Resolve<T>(params object?[])

Gets an instance of the specified service using the plugins dependency injection container.

public T Resolve<T>(params object?[] arguments)

Parameters

arguments object[]

Arguments to supply to the service.

Returns

T

An instance of the service.

Type Parameters

T

The service to resolve.

See Also

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Events

Disabled

Occurs when the plugin is disabled

public event EventHandler? Disabled

Event Type

EventHandler

Enabled

Occurs when the plugin is enabled

public event EventHandler? Enabled

Event Type

EventHandler

FeatureAdded

Occurs when an feature is loaded and added to the plugin

public event EventHandler<PluginFeatureInfoEventArgs>? FeatureAdded

Event Type

EventHandler<PluginFeatureInfoEventArgs>

FeatureRemoved

Occurs when an feature is disabled and removed from the plugin

public event EventHandler<PluginFeatureInfoEventArgs>? FeatureRemoved

Event Type

EventHandler<PluginFeatureInfoEventArgs>