mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
Add DriverName property
This commit is contained in:
@@ -260,16 +260,7 @@ internal class ConsoleDriverFacade<T> : IConsoleDriver, IConsoleDriverFacade
|
||||
/// <inheritdoc/>
|
||||
public virtual string GetVersionInfo ()
|
||||
{
|
||||
var type = "";
|
||||
|
||||
if (InputProcessor is WindowsInputProcessor)
|
||||
{
|
||||
type = "win";
|
||||
}
|
||||
else if (InputProcessor is NetInputProcessor)
|
||||
{
|
||||
type = "net";
|
||||
}
|
||||
var type = InputProcessor.DriverName;
|
||||
|
||||
return "v2" + type;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ public interface IInputProcessor
|
||||
/// <summary>Event fired when a mouse event occurs.</summary>
|
||||
event EventHandler<MouseEventArgs>? MouseEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the driver associated with this input processor.
|
||||
/// </summary>
|
||||
string DriverName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when a key is pressed down. Fires the <see cref="KeyDown"/> event. This is a precursor to
|
||||
/// <see cref="OnKeyUp"/>.
|
||||
|
||||
@@ -30,6 +30,9 @@ public abstract class InputProcessor<T> : IInputProcessor
|
||||
/// </summary>
|
||||
public ConcurrentQueue<T> InputBuffer { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DriverName { get; init; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IAnsiResponseParser GetParser () { return Parser; }
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@ public class NetInputProcessor : InputProcessor<ConsoleKeyInfo>
|
||||
#pragma warning restore CA2211
|
||||
|
||||
/// <inheritdoc/>
|
||||
public NetInputProcessor (ConcurrentQueue<ConsoleKeyInfo> inputBuffer) : base (inputBuffer, new NetKeyConverter ()) { }
|
||||
public NetInputProcessor (ConcurrentQueue<ConsoleKeyInfo> inputBuffer) : base (inputBuffer, new NetKeyConverter ())
|
||||
{
|
||||
DriverName = "net";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void Process (ConsoleKeyInfo consoleKeyInfo)
|
||||
|
||||
@@ -13,7 +13,10 @@ internal class WindowsInputProcessor : InputProcessor<InputRecord>
|
||||
private readonly bool [] _lastWasPressed = new bool[4];
|
||||
|
||||
/// <inheritdoc/>
|
||||
public WindowsInputProcessor (ConcurrentQueue<InputRecord> inputBuffer) : base (inputBuffer, new WindowsKeyConverter ()) { }
|
||||
public WindowsInputProcessor (ConcurrentQueue<InputRecord> inputBuffer) : base (inputBuffer, new WindowsKeyConverter ())
|
||||
{
|
||||
DriverName = "win";
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void Process (InputRecord inputEvent)
|
||||
|
||||
Reference in New Issue
Block a user