Page 1 of 1

Making a modding program.

Posted: Fri May 02, 2008 8:04 pm
by Andrew_b
Ok well, I have been reading tutorials on how to parse text files. Im a bit confused and was wondering if someone could help me.

Code: Select all

bank : _nameless.114B.FCB0 {
 money_account: 50000
 loans: 0
}
Thats the format of the whole file...except alot more data.

How would i get my program to open the file, Read the words between } and { and put it into a list box or a tree view of some sort (like hmt) I am using VB. Any help whatsoever would be awesome! :D

Posted: Fri May 02, 2008 10:19 pm
by Anthony
use C# and I will help a bit

Posted: Sat May 03, 2008 9:18 am
by Patrickssj6
Anthony wrote:use C# and I will help a bit
How about you post the code in C# and he can convert it himself. I know C# is better now that I use it myself, but there are no huge differences...only thing I miss the the Optional property for the parameters :P

Basically what you could do is loop through until you find { then go to the next line and so on until }.

There are multiple ways of doing this. Especially in VB you have text functions that could help you like EOF and so on.

With a StreamReader you just increase the offset until you find { then you skip the first space, add the next chars to an array until next space then you know you are getting the next word etc.

Do it yourself. :wink:

Posted: Sat May 03, 2008 9:26 am
by Andrew_b
Thanks for the explanation, it makes more sense than when i was just on msdn trying to read stuff.