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