This is a C# question.
I was just wandering if anyone tried storing their data (like config files for example), in the *.cs file, instead of XML?
I really hate XML. The whole idea of parsing html-like structure every time you need some data seems stupid.
Are there lightweight alternatives (like YAML) to XML? In my case I actually need to store some data for a (game) Level, where there are a lot of different objects, terrain types, etc… in a flat file, so I can read it later.
I guess I could serialize my Level class, but I want the data-file to be EDITABLE in any text editor for example.
Any help would be welcome, thanks!
PS: Regarding .cs files, I forgot to mention that I want the ability to create (and save) new levels in game, through an editor.
Since you don’t want to use XML, I’d recommend creating your own file format that is text editable.
and so on so forth for whatever else you need.
Creating a parser yourself is really straight forward. Pretty much just read in the file line by line. At the first line, you see the title is PROPERTIES so you then read in properties until you read in the END line. Same thing for any other headers you’d have. There are many ways you can vary this, so you can make the syntax however you want it to be.