On my client-server system, a user can change a value of a Variable, say "System Power" in a drop-down box ("ON", "OFF", "STANDBY").
When clicking an index, a message gets passed to the server to change the variable that captures the state of "System Power" in this case.
Currently, my server-side code is implemented to try to convert the value in the client's message as an Int64.
Here are my thoughts as to a solution:
1 - hard code logic in my client-side code to send the right Int64 value. Example: send message(System Power, 1) instead of message(System Power, OFF).
2 - from the client-side, read an XML file that maps Variable's state (ON, OFF) to an Int64 value
3 - fix the server-side to behave correctly.
I think #1 is a poor option due to inflexibility. #3 is the right option, but it will take me too long on my schedule.
To implement #2, would it make sense to create an XML file like this:
<root>
<Variables>
<System Power>
<element name="ON">1</element>
<element name="OFF">0</element>
...
Then, in my client-side code, I could perform a look-up in the XML file to determine the correct message(System Power, 0).
Please advise. Thank you.