INI file questions
Date: 02/28/06
(C Sharp) Keywords: database, java
Hi all!
I've been trying to go from beginner's Java to C#, as I prefer C# much more. I just love the feel of it and the ability to design the forms much like VB.NET is a huge time saver for me. Still, there's some things that I just can't seem to figure out (nor can seem to locate on the internet).
Basically I'm going to be making a text adventure game in C#, but I like to store all of the data in INI files. I'd like to have one .txt file and inside it would store every room with exits and interactive objects. For example:
[0001]
Name=Town Square
Exits=north, south
North=0002
South=0003
[0002]
Name=North of Town Square
Exits=north, south, east, west
North=0004
South=0001
East=0005
West=0006
NPCs=A strange old man
etc etc etc.
And another file for all of the NPCs, what they'd say to the player and so on. But the problem is.. I'm not sure how to actually READ ini files in C# (or Java, or C, or C++, or VB.NET for that matter). I'm not sure if there's a better way of doing this. I don't know any database commands, or if I can even run them (or if any of the player who eventually download this can run them either). I figured with this I could include the rooms.txt as part of the program (as a resource, like images) and that way there'd be no question of players messing with them or peeking at them to see where to go/do/etc.
So my real reason for this post is to ask for help on learning how to read/write INIs (I may want to write a player file in INI format, then encrypt it).
Any help or tips would be most appreciated.
Source: http://community.livejournal.com/csharp/50870.html