Add DriverName property

This commit is contained in:
BDisp
2025-09-16 00:45:04 +01:00
parent 5178eda2da
commit b0949c962f
5 changed files with 17 additions and 12 deletions

View File

@@ -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;
}

View File

@@ -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"/>.

View File

@@ -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; }

View File

@@ -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)

View File

@@ -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)