mirror of
https://github.com/fasteddy516/SimplySerial.git
synced 2024-11-13 22:01:46 +00:00
Don't process virtual terminal sequences in RAW encoding mode
This commit is contained in:
parent
a5f3f36fb6
commit
ad7a3fa920
@ -85,25 +85,28 @@ namespace SimplySerial
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// attempt to enable virtual terminal escape sequence processing
|
||||
try
|
||||
{
|
||||
var iStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
GetConsoleMode(iStdOut, out uint outConsoleMode);
|
||||
outConsoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode(iStdOut, outConsoleMode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// if the above fails, it doesn't really matter - it just means escape sequences won't process nicely
|
||||
}
|
||||
|
||||
// load and parse data in boards.json
|
||||
LoadBoards();
|
||||
|
||||
// process all command-line arguments
|
||||
ProcessArguments(args);
|
||||
|
||||
// attempt to enable virtual terminal escape sequence processing
|
||||
if (!convertToPrintable)
|
||||
{
|
||||
try
|
||||
{
|
||||
var iStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
GetConsoleMode(iStdOut, out uint outConsoleMode);
|
||||
outConsoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode(iStdOut, outConsoleMode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// if the above fails, it doesn't really matter - it just means escape sequences won't process nicely
|
||||
}
|
||||
}
|
||||
|
||||
Console.OutputEncoding = encoding;
|
||||
|
||||
// verify log-related settings
|
||||
@ -639,7 +642,7 @@ namespace SimplySerial
|
||||
string newMessage = "";
|
||||
foreach (byte c in message)
|
||||
{
|
||||
if ((c > 31 && c < 128) || (c == 8) || (c == 9) || (c == 10) || (c == 13) || (c == 27))
|
||||
if ((c > 31 && c < 128) || (c == 8) || (c == 9) || (c == 10) || (c == 13))
|
||||
newMessage += (char) c;
|
||||
else
|
||||
newMessage += $"[{c:X2}]";
|
||||
|
Loading…
Reference in New Issue
Block a user