looping through text in a text file

Hi there guys. I have a text file that I’m using to store a user’s session in my C# app. I need to load the info back into my app and all is working fine but for one section where I need to loop through a section of lines. I think it is best explained to look at the file structure, here it is:

PageName=aaa
PageTimespan=10
Clocks
Clock=(-21.9, 5.4, -5.0);Point2
Clock=(0.0, 15.8, -5.0);Point5
Clock=(24.1, 5.8, -5.0);Point8
NewCurve
curvePoints=(-35.9, -1.9, -5.0)
curvePoints=(-35.9, -1.9, -5.0)
curvePoints=(-6.4, 13.7, -5.0)
curvePoints=(5.2, 14.6, -5.0)
curvePoints=(35.9, 0.6, -5.0)
curvePoints=(35.9, 0.6, -5.0)
NewCurve
curvePoints=(-35.9, -4.7, -5.0)
curvePoints=(-35.9, -4.7, -5.0)
curvePoints=(-3.8, -9.2, -5.0)
curvePoints=(8.5, -9.5, -5.0)
curvePoints=(36.2, -1.8, -5.0)
curvePoints=(36.2, -1.8, -5.0)
PageName=bbb
PageTimespan=20
Clocks
Clock=(-22.7, 1.4, -5.0);Point2
Clock=(-4.8, 4.4, -5.0);Point4
Clock=(25.9, 3.2, -5.0);Point8
NewCurve
curvePoints=(-34.8, -4.8, -5.0)
curvePoints=(-34.8, -4.8, -5.0)
curvePoints=(-7.0, 9.1, 0.0)
curvePoints=(-0.1, 1.0, -5.0)
curvePoints=(36.2, 4.8, -5.0)
curvePoints=(36.2, 4.8, -5.0)

The only part my question is about is how would I loop form NewCurve, through the curvePoints until the next section is reached and store those curvePoints in a list. The focus of my question is on the actuall loop, not the parsing of the data etc. I have tried a do while loop, but I can’t seem to get it right!

Any help will be much appreciated

it is best to use xml files for this as .NET has things built in to automatically serialize and deserialize xml files

check here for code:

what eem said is correct, should probably use xml but if you really don’t want to

http://msdn.microsoft.com/en-us/library/aa287535(v=vs.71).aspx

Eem, It can’t be xml since it has to be compatible with another text-based system and the users must be able to edit the text file without having to understand xml.

Also, tertle, did you read my question properly? The link you posted does not relate to my question at all. Like I said, my question is related to looping through the specific section and not reading line by line like your link explain. I know how to do that, thanks.

anyone that can maybe help with this?