C# read Ini Values from Keys

09/22/2014 10:26 Ammy'#1
Hey,

im curently learning a bit and wanted to get values from keys from a .ini-file

The .ini is like this:

[Section]
key=value;key=value;key=value;

I tried it with the GetPrivateProfileSection()-method but it only gives me this

key
key
key

Is there a way to only get the Values ?
09/22/2014 11:33 Requi#2
Unterstützt .NET schon direkt ini Files oder benutzt du eine Klasse? Falls ersteres, such online (am Besten msdn) mal nach allen Methoden, die dir zur Verfügung stehen. Ansonsten suchst du dir online eine Klasse zum Lesen und Schreiben von ini Files.
Falls jedoch zweiteres, brauchen wir den Code der Klasse ;)
09/22/2014 11:45 Ammy'#3
Hey,

thank you. (i will keep this in english because maybe someone can help me)

Microsoft suggest XML Configfiles so it does not contain Methods for reading Ini's directly. I tried a library called "ini-parser" from GitHub, but as unlucky as i am only supports Ini-Files like this:

[Section]
Key=Value
Key=Value

Thanks for your repsonse anyway


Edit: [Only registered and activated users can see links. Click Here To Register...] thats the lib i tried to use ^^
09/22/2014 11:48 Requi#4
So you want a ini file with ";" instead of a new line?
09/22/2014 11:51 Ammy'#5
Yup. Else it would be easy and ive already made one reading out

Key=Value
Key=Value

But i want to learn more (maybe for tools later on where the programs have ";"-seperated configs)
09/22/2014 11:56 Requi#6
Currently I'm not at home to help you and give you a ini parsing class.

But you can add me on skype and I'll help you as soon as possible. Just click on the skype icon right under my profile picture and stats.
09/22/2014 11:57 Ammy'#7
Will do later, thanks ^^

Okay i experimented a bit more.

I again used the lib i stated and let it return the value of the first key

obviously it returns:

value;key=value;key=value

now i splitted the string at every ;

and now got a string[] containing this

value
key=value
key=value

how can i now get the keys removed ?


Edit: A Friend helped me and the Problem is solved
09/22/2014 15:33 snow#8
#closed (on request)