These are chat archives for CoraleStudios/Colore

21st
Jan 2016
Roxas Keyheart
@roxaskeyheart
Jan 21 2016 14:22
This is probably going to sound like a dumb question but if I have a string which contains a value such as "D1" or "A", can I convert that to a Corale.Colore.Razer.Keyboard.Key value to be used in a SetKey?
Adrian
@WolfspiritM
Jan 21 2016 14:22
@roxaskeyheart Use Enum.Parse
Corale.Colore.Razer.Keyboard.Key key = Enum.Parse(typeof(Corale.Colore.Razer.Keyboard.Key),"D1")
You can also use Enum.TryParse to also check if it's possible to parse instead of using try catch
Roxas Keyheart
@roxaskeyheart
Jan 21 2016 14:26
Lool I feel like that should have been obvious to me TT.TT
Thanks for that ^^
Adrian
@WolfspiritM
Jan 21 2016 14:26
No Problem :-)
Roxas Keyheart
@roxaskeyheart
Jan 21 2016 14:27
cannot convert from 'object' to 'Corale.Colore.Razer.Keyboard.Key'
.>;;
Adrian
@WolfspiritM
Jan 21 2016 14:27
Corale.Colore.Razer.Keyboard.Key key = (Corale.Colore.Razer.Keyboard.Key)Enum.Parse(typeof(Corale.Colore.Razer.Keyboard.Key),"D1")
Roxas Keyheart
@roxaskeyheart
Jan 21 2016 14:27
ah it was the brackets..
tyty
Adrian
@WolfspiritM
Jan 21 2016 14:28
no problem