Page 1 of 1

Please check UC.Readkey function

PostPosted: Sun Nov 05, 2017 7:12 am
by shad
Hello Balazs!
Please check UC.Readkey function.
I had situation with empty key value in profile file.
Key was without value:
Code: Select all
OxySlideOffset =

When I try to read this key it's return nothing. I was sure ReadKey function return defaul value. For example this function must return "0" string in any case:
Code: Select all
string value = UC.Readkey("PlasmaOxyPinMapping", "OxySlideOffset", "0");

Or I am wrong?

Re: Please check UC.Readkey function

PostPosted: Sun Nov 05, 2017 9:20 am
by Dan911
Testing I've done with Read/Write key... is Readkey never looks at the value you input and just writes value of key your reading. If that value is empty it will return empty. If you want a default value for a key you need to write it there.

Dan

Re: Please check UC.Readkey function

PostPosted: Sun Nov 05, 2017 10:26 am
by cncdrive
Hi Andrew,

If the key is defined in the profile file, but the value is empty then the Readkey function will return an empty string.
The Readkey function returns the default value only if the key is not defined.

If you don't allow empty value then simply test the read value for empty string and if it matches then give it a different value or do your exception routine.

Re: Please check UC.Readkey function

PostPosted: Tue Nov 07, 2017 5:29 pm
by shad
Hello!
Thank you for explain.
Balazs, please do not forgot about function in the API for turn on moveback on arc lost future independent from the THC ON/OFF state.