Don't process virtual terminal sequences in RAW encoding mode

This commit is contained in:
Edward Wright 2023-02-16 10:06:13 -05:00
parent a5f3f36fb6
commit ad7a3fa920

View File

@ -85,7 +85,15 @@ namespace SimplySerial
static void Main(string[] args) static void Main(string[] args)
{ {
// load and parse data in boards.json
LoadBoards();
// process all command-line arguments
ProcessArguments(args);
// attempt to enable virtual terminal escape sequence processing // attempt to enable virtual terminal escape sequence processing
if (!convertToPrintable)
{
try try
{ {
var iStdOut = GetStdHandle(STD_OUTPUT_HANDLE); var iStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
@ -97,12 +105,7 @@ namespace SimplySerial
{ {
// if the above fails, it doesn't really matter - it just means escape sequences won't process nicely // 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);
Console.OutputEncoding = encoding; Console.OutputEncoding = encoding;
@ -639,7 +642,7 @@ namespace SimplySerial
string newMessage = ""; string newMessage = "";
foreach (byte c in message) 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; newMessage += (char) c;
else else
newMessage += $"[{c:X2}]"; newMessage += $"[{c:X2}]";