← Back to team overview

coapp-developers team mailing list archive

Re: Input for Autopackage

 

Oh, one FYI:

You might be tempted to use the .Value on a property--more than likely you really want .LValue ... the Value will give you the whole value/compound value/collection formatted for output (ie, quoted, indented, etc).

G

-----Original Message-----
From: Garrett Serack 
Sent: Wednesday, April 27, 2011 8:45 PM
To: Garrett Serack; Eric Schultz (wwahammy@xxxxxxxxx)
Cc: coapp-developers
Subject: RE: [Coapp-developers] Input for Autopackage

Eric, 

I've updated the coapp toolkit PropertySheet  code to support parsing the format for Autopackage (sample: http://j.mp/mkoWkn  ) and actually another use I have in building a tool to simplify shallowforking (called pTk... sample http://j.mp/lz5aha ). 

The format is pretty damn nice--my earlier parser only needed a couple tweaks to get everything you and I needed.

It's also pretty simple to use--sample : http://j.mp/mvS9M6 (You can even persist out the property sheet back to disk with .Save()  :D)

Generally the property sheet is a collection of rules, each rule can have a Selector, Class, Id and Parameter (defined along the lines of css)

You can just do rule queries using linq (ie... from rule in propertySheet where rule.Selector == "pkg" select rule ) or you can use the indexer[] on the propertysheet.

Each rule can have a number of properties. A property has a name (which can contain letters, numbers, dashes) and a Value (which really can be compound (lvalue = rvalue), expression (surrounded in parenthesis ), a collection of strings or simply a string value) -- check out the Rule class, it's pretty simple. 


As I mentioned, the syntax for the file is largely compatible with css, with a few notable exceptions:
- block comments /* */ as well as double slashes // are supported for comments 
- string values can be quoted, (as both halves of a compound value)... example: http://j.mp/j1DWme ... Happy, sad, and silly are all pretty much the same
- supports c# style @"strings"  (noted by 'fudge' in the sample)
- it's pretty damn backslash friendly. 
- expressions are values that are surrounded in parenthesis () ... ie ({$CURRENT}-1) .. you'll get the contents (sans whitespace) but it doesn't provide any magic to evaluate that for you. I'm sure we can whip something up with dynamic code if you need to..

G

   

-----Original Message-----
From: coapp-developers-bounces+garretts=microsoft.com@xxxxxxxxxxxxxxxxxxx [mailto:coapp-developers-bounces+garretts=microsoft.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of Garrett Serack
Sent: Wednesday, April 27, 2011 1:14 PM
To: Philip Allison
Cc: coapp-developers
Subject: Re: [Coapp-developers] Input for Autopackage

We've actually got a parser in CoApp already that handles this format for another purpose (which is kinda why we went this way), so in the immediate future we'll rely on that.

I have another case I may be using this too, so it's nice that we have some overlap.

G
________________________________________
From: Philip Allison [mangobrain@xxxxxxxxxxxxxx]
Sent: Wednesday, April 27, 2011 11:34 AM
To: Garrett Serack
Cc: Eric Schultz; coapp-developers
Subject: Re: [Coapp-developers] Input for Autopackage

IMHO the quality of parsing & validation is just as important as the file format itself.  I'd be happy to put up with most things in terms of file format, on the proviso that if I get it wrong, autopackage does a reasonable job of telling me what's wrong and where in the file it is.  FWIW I quite like the example syntax - it reminds me of what libconfuse accepts.  In fact, it might be worth seeing if you could just use libconfuse itself; I can't remember if it comes with VS build files, but I've definitely used it on Windows before, and it's small, self-contained & liberally licensed.


_______________________________________________
Mailing list: https://launchpad.net/~coapp-developers
Post to     : coapp-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~coapp-developers
More help   : https://help.launchpad.net/ListHelp



References