1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed ToString/Parse for unknown codes

This commit is contained in:
Brian Fiete 2020-09-28 17:08:12 -07:00
parent e19c8857b0
commit c5b48a1dc1

View file

@ -119,6 +119,12 @@ namespace Beefy.widgets
return (KeyCode)(c.ToUpper);
}
if (str.StartsWith("0x"))
{
if (int code = int.Parse(str))
return .Ok((.)code);
}
return Enum.Parse<KeyCode>(str, true);
}
@ -131,7 +137,13 @@ namespace Beefy.widgets
return;
}
int buffStart = strBuffer.Length;
base.ToString(strBuffer);
if ((strBuffer.Length > buffStart) && (strBuffer[buffStart].IsDigit))
{
strBuffer.RemoveToEnd(buffStart);
strBuffer.AppendF("0x{:X}", (int32)this);
}
}
}
}