Escape invisible character is debug mode

This commit is contained in:
Stone_Red
2024-08-08 23:57:40 +02:00
parent ec2f294796
commit 9a6f1d7806
6 changed files with 42 additions and 34 deletions
@@ -4,35 +4,34 @@ using System.Threading;
using YesNt.Interpreter.Runtime;
namespace YesNt.Interpreter.Utilities
{
internal static class ConsoleExtentions
{
public static char ReadKey(RuntimeInformation runtimeInformation)
{
while (!runtimeInformation.Stop)
{
if (Console.KeyAvailable)
{
return Console.ReadKey().KeyChar;
}
Thread.Sleep(10);
}
return ' ';
}
namespace YesNt.Interpreter.Utilities;
public static void Sleep(int millisecondsTimeout, RuntimeInformation runtimeInformation)
internal static class ConsoleExtensions
{
public static char ReadKey(RuntimeInformation runtimeInformation)
{
while (!runtimeInformation.Stop)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
while (!runtimeInformation.Stop)
if (Console.KeyAvailable)
{
if (stopwatch.ElapsedMilliseconds > millisecondsTimeout)
{
return;
}
Thread.Sleep(10);
return Console.ReadKey().KeyChar;
}
Thread.Sleep(10);
}
return ' ';
}
public static void Sleep(int millisecondsTimeout, RuntimeInformation runtimeInformation)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
while (!runtimeInformation.Stop)
{
if (stopwatch.ElapsedMilliseconds > millisecondsTimeout)
{
return;
}
Thread.Sleep(10);
}
}
}