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:
parent
e19c8857b0
commit
c5b48a1dc1
1 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue