mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/159bd460-7950-4afe-9e69-4892220665e1 Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
73 lines
1.8 KiB
C#
73 lines
1.8 KiB
C#
using System;
|
|
|
|
namespace MinecraftClient
|
|
{
|
|
/// <summary>
|
|
/// Input buffer state passed with OnInputChange events.
|
|
/// </summary>
|
|
public readonly struct ConsoleInputBuffer
|
|
{
|
|
public string Text { get; }
|
|
public int CursorPosition { get; }
|
|
|
|
public ConsoleInputBuffer(string text, int cursorPosition)
|
|
{
|
|
Text = text;
|
|
CursorPosition = cursorPosition;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Backend-independent suggestion item used by the TUI autocomplete popup.
|
|
/// Mirrors the shape of ConsoleInteractive.ConsoleSuggestion.Suggestion
|
|
/// without requiring a dependency on the ConsoleInteractive assembly.
|
|
/// </summary>
|
|
public readonly struct CommandSuggestion
|
|
{
|
|
public string Text { get; }
|
|
public string Tooltip { get; }
|
|
|
|
public CommandSuggestion(string text, string tooltip = "")
|
|
{
|
|
Text = text;
|
|
Tooltip = tooltip;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Abstraction over the console I/O backend.
|
|
/// Implementations: ClassicConsoleBackend (ConsoleInteractive), TuiConsoleBackend (Avalonia/Consolonia), BasicConsoleBackend (stdio).
|
|
/// </summary>
|
|
public interface IConsoleBackend
|
|
{
|
|
void Init();
|
|
|
|
void WriteLine(string text);
|
|
|
|
void WriteLineFormatted(string text);
|
|
|
|
void BeginReadThread();
|
|
|
|
void StopReadThread();
|
|
|
|
event EventHandler<string>? MessageReceived;
|
|
|
|
event EventHandler<ConsoleInputBuffer>? OnInputChange;
|
|
|
|
string RequestImmediateInput();
|
|
|
|
string? ReadPassword();
|
|
|
|
void ClearInputBuffer();
|
|
|
|
void ClearScreen();
|
|
|
|
bool DisplayUserInput { get; set; }
|
|
|
|
void SetInputVisible(bool visible);
|
|
|
|
void SetBackreadBufferLimit(int limit);
|
|
|
|
void Shutdown();
|
|
}
|
|
}
|