12-04-2017 12:06 PM - edited 12-04-2017 12:09 PM
I am trying to create a config file that will be able to enable/disable channels and control the range of the channel. The settings for each channel are stored in a cluster. There is a boolean value for channel enable, a value for the coupling, and a value for the input range. From what I've found it seems like you have to convert the cluster into a xml string, but when I put an indicator after the flatten to xml it only displays <Cluster>. Is there a simple way to be able to separate them, to create configs for each case that will be used?
12-04-2017 12:22 PM
There are some toolkits that make this really easy. I like the MGI Read/Write anything and OpenG Variant Config toolkits, both of which can be downloaded through VIPM.
12-04-2017 01:22 PM
@randomguy77 wrote:
From what I've found it seems like you have to convert the cluster into a xml string, but when I put an indicator after the flatten to xml it only displays <Cluster>. \
Your problem there is that XML is a multi-line format. So you are probably not showing the rest of the lines in your indicator. Worse still is that this will not work inside of a configuration file.
Use the MGI or OpenG toolkits already mentioned. They have done all of the work for you.
12-04-2017 01:33 PM
I've seen OpenG mentioned a few times no so decided to try it. Every time I try to install it through VIPM is keeps failing to install. I'm not able to access sourceforge with my work network, so guessing I'll just have to download it at home and throw it onto a junk drive to give it a go.
12-04-2017 01:55 PM
This could be because you don't have the latest version of VIPM, or you need to run VIPM as administrator, or it is being blocked by your firewall.
Also, do try the MGI toolkits, I actually prefer their version for config files, and it scales much better with larger data.
12-04-2017 02:11 PM
I download the MGI kit as well, I'm playing around with that right now trying to figure out how it changes the cluster values and what all needs to be done to setup it correctly.
12-05-2017 03:00 AM
The to/from XML should work well, but you'll need to Escape/unescape the text so you don't get strange effects.
/Y
12-05-2017 07:31 AM
I'd personally won't store a cluster in a single key.
Instead, I'd make a section, and store the elements in keys. You'll avoid the huge problems if (when) the order of cluster elements changes, or if an element is added or removed.
To\From XML will fail when the cluster changes (ironically, since XML should be flexible).
The simple solution is to format a string from the elements. So simply use a format into string and scan from string to set\get the string.
And obviously clusters like these are good candidates for classes. Then each class can store and load itself... A section\key construct will work better for this as well.