104 lines
3.2 KiB
C#
104 lines
3.2 KiB
C#
namespace Dashboard.Pal
|
|
{
|
|
/// <summary>
|
|
/// Information about this context interface.
|
|
/// </summary>
|
|
public interface IContextInterfaceInfo
|
|
{
|
|
/// <summary>
|
|
/// Name of this driver.
|
|
/// </summary>
|
|
string DriverName { get; }
|
|
|
|
/// <summary>
|
|
/// The vendor for this driver.
|
|
/// </summary>
|
|
string DriverVendor { get; }
|
|
|
|
/// <summary>
|
|
/// The version of this driver.
|
|
/// </summary>
|
|
Version DriverVersion { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The base context interface.
|
|
/// </summary>
|
|
public interface IContextBase : IContextInterfaceInfo, IDisposable
|
|
{
|
|
/// <summary>
|
|
/// The debugger for this context.
|
|
/// </summary>
|
|
IContextDebugger? Debugger { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The base context interface.
|
|
/// </summary>
|
|
/// <typeparam name="TContext">The context type.</typeparam>
|
|
/// <typeparam name="TExtension">The extension type, if used.</typeparam>
|
|
public interface IContextBase<TContext, in TExtension> : IContextBase
|
|
where TContext : IContextBase<TContext, TExtension>
|
|
where TExtension : IContextExtensionBase<TContext>
|
|
{
|
|
/// <summary>
|
|
/// Is such an extension available?
|
|
/// </summary>
|
|
/// <typeparam name="T">The extension to check.</typeparam>
|
|
/// <returns>True if the extension is available.</returns>
|
|
bool IsExtensionAvailable<T>() where T : TExtension;
|
|
|
|
/// <summary>
|
|
/// Preload extensions, to be lazy loaded when required.
|
|
/// </summary>
|
|
/// <typeparam name="T">The extension to preload.</typeparam>
|
|
/// <returns>
|
|
/// True if the extension was added to the preload set. Otherwise, already loaded or another extension
|
|
/// exists which provides this.
|
|
/// </returns>
|
|
bool ExtensionPreload<T>() where T : TExtension, new();
|
|
|
|
/// <summary>
|
|
/// Require an extension.
|
|
/// </summary>
|
|
/// <typeparam name="T">The extension to require.</typeparam>
|
|
/// <returns>The extension instance.</returns>
|
|
T ExtensionRequire<T>() where T : TExtension, new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Base interface for all context extensions.
|
|
/// </summary>
|
|
public interface IContextExtensionBase : IContextInterfaceInfo, IDisposable
|
|
{
|
|
/// <summary>
|
|
/// The context that loaded this extension.
|
|
/// </summary>
|
|
IContextBase Context { get; }
|
|
|
|
/// <summary>
|
|
/// Require this extension.
|
|
/// </summary>
|
|
/// <param name="context">The context that required this extension.</param>
|
|
void Require(IContextBase context);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Base interface for all context extensions.
|
|
/// </summary>
|
|
public interface IContextExtensionBase<TContext> : IContextExtensionBase
|
|
where TContext : IContextBase
|
|
{
|
|
/// <summary>
|
|
/// The context that loaded this extension.
|
|
/// </summary>
|
|
new TContext Context { get; }
|
|
|
|
/// <summary>
|
|
/// Require this extension.
|
|
/// </summary>
|
|
/// <param name="context">The context that required this extension.</param>
|
|
void Require(TContext context);
|
|
}
|
|
}
|