Reading capabilities from file

Issue #101 new
Petar Stojanovski created an issue

Hello,

I have successfully managed to write the current capabilities from the scanner in a *.txt file, similar to what is done in the DataSourceVM.

However, when I try to read the values back I come across an error connected to the types of the values (whether it is Int32, TWFix32, Enum, etc).

Is there a way to set the capabilities once the program starts?

I am sorry if it has already been answered, I couldn't find it anywhere.

Thanks!

Comments (3)

  1. Eugene Wang repo owner

    Some scanners have a way to load profiles using custom capabilities (or something, not sure) but that's probably not what you want.

    There's no easy way to restore settings in a simple generic loop since some settings require certain order or overwrites others. Most reliable way is to only pick certain settings to save and apply them at load time in correct order. If going this way then you'd already know what those values are and what type to use.

    Otherwise you'll have to record additional thing like it's type when saving the values so you know how to load them at startup.

  2. Petar Stojanovski reporter

    Thank you, Eugene, for the explanation.

    I figured it out that I need to save both the values and the types, and I managed to do it. However, my problem now is that all the values are strings and when I try to set the value to do capabilities the type doesn't correspond.

    I know it is a different question, but do you know how to convert that same string into the corresponding type (whether it is Int32, TWFix32, Enum..)?

    Thanks

  3. Log in to comment