Re: PrefsObject
Posted: Fri Sep 18, 2015 2:18 am
I am happy to help out with suggestions, but I still need some example code to start with. Could someone post the example(s) on here?
Support Forum
https://forum.hyperion-entertainment.com/
https://forum.hyperion-entertainment.com/viewtopic.php?t=3176
I was just going to suggest the same thing!salass00 wrote:Currently application.library reads and writes version 1.0 pobjects files but it should be simple enough to make a new version of the library that reads version 1.0 and version 2.0 pobjects file and writes in the latter format only.
Will do.If you have suggestions on how the new pobjects format should look then please post them here.
No, the system is cool (though still a little undocumented). It's just the current XML schema that is bad.mritter0 wrote:Am I wasting my time using PrefsObject system?
Current:salass00 wrote:Well if there are problems with the current pobjects format then they can be fixed in application.library.broadblues wrote: I wouldn't use it myself, it produces horid unstructured xml, where the only relation between a key and value is that value follows immediatly after the key.
Currently application.library reads and writes version 1.0 pobjects files but it should be simple enough to make a new version of the library that reads version 1.0 and version 2.0 pobjects file and writes in the latter format only.
If you have suggestions on how the new pobjects format should look then please post them here.
Code: Select all
<key>Filer.def.dstbackground2pen.r</key>
<string>0xEEEDEEED</string>
Code: Select all
<item>
<key>Filer.def.dstbackground2pen.r</key>
<string>0xEEEDEEED</string>
</item>
Code: Select all
<item key="Filer.def.dstbackground2pen.r" type="string" >
0xEEEDEEED
</item>
<item key="Filer.def.search.filename.case" type="bool" >
TRUE
</item>
How about something like this?broadblues wrote:Code: Select all
<item key="Filer.def.dstbackground2pen.r" type="string" > 0xEEEDEEED </item> <item key="Filer.def.search.filename.case" type="bool" > TRUE </item>
There are a lot of variations ofcourse, Trixie may have better suggestions still...
Code: Select all
<string key="Filer.def.dstbackground2pen.r>0xEEEDEEED</string>
<bool key="Filer.def.search.filename.case">TRUE</bool>
Code: Select all
<item key="Filer.def.dstbackground2pen.r" type="string" > 0xEEEDEEED </item> <item key="Filer.def.search.filename.case" type="bool" > TRUE </item>
I'd prefer the first option over the second, since with a general <item> structure it'd be very easy to f.i. create a general GUI that can edit all items, using a fallback text gadget, whereas with the type defining in the tag, you'd have to support all possible types in order to parse the file. I'm also assuming that the "type" attribute could be something application specific, like type="email" allowing the application to validate it, whereas application.library would only treat it as text.Code: Select all
<string key="Filer.def.dstbackground2pen.r>0xEEEDEEED</string> <bool key="Filer.def.search.filename.case">TRUE</bool>
On the other hand, Chris' suggestion looks much more human-readable, so if we are to arrive at a compromise between "easy to parse" and "easy to read and edit manually", I'd probably go with something like that. And from the viewpoint of the parser, I guess there's not much difference between handling six different elements (there are six types of PrefsObject) and six different attributes - you need to process them anyway.jaokim wrote:I'd prefer the first option over the second
As I see it this won't be a problem since only application.library should be used for parsing these files.jaokim wrote: I'd prefer the first option over the second, since with a general <item> structure it'd be very easy to f.i. create a general GUI that can edit all items, using a fallback text gadget, whereas with the type defining in the tag, you'd have to support all possible types in order to parse the file. I'm also assuming that the "type" attribute could be something application specific, like type="email" allowing the application to validate it, whereas application.library would only treat it as text.
Well I'm not keen on that format. My objection to the original was lack of structure. The point of using xml in the first place (IMHO at least) is to export data in a structured way, other wise you might as wel use plain text.salass00 wrote:
How about something like this?
Code: Select all
<string key="Filer.def.dstbackground2pen.r>0xEEEDEEED</string> <bool key="Filer.def.search.filename.case">TRUE</bool>
Code: Select all
<pobjects version="2.0">
<dict>
<item key="itemone">
<bool>FALSE</bool>
</item>
<item key="itemtwo">
<string>This is the winter of our discontent</string>
</item>
</dict>
</pobject>