Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 14:59

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# read Ini Values from Keys

Discussion on C# read Ini Values from Keys within the .NET Languages forum part of the Coders Den category.

Closed Thread
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2014
Posts: 896
Received Thanks: 100
C# read Ini Values from Keys

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 ?
Ammy' is offline  
Old 09/22/2014, 11:33   #2


 
Requi's Avatar
 
elite*gold: 3570
The Black Market: 244/0/0
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
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
Requi is offline  
Old 09/22/2014, 11:45   #3
 
elite*gold: 0
Join Date: Sep 2014
Posts: 896
Received Thanks: 100
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: thats the lib i tried to use ^^
Ammy' is offline  
Old 09/22/2014, 11:48   #4


 
Requi's Avatar
 
elite*gold: 3570
The Black Market: 244/0/0
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
So you want a ini file with ";" instead of a new line?
Requi is offline  
Old 09/22/2014, 11:51   #5
 
elite*gold: 0
Join Date: Sep 2014
Posts: 896
Received Thanks: 100
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)
Ammy' is offline  
Old 09/22/2014, 11:56   #6


 
Requi's Avatar
 
elite*gold: 3570
The Black Market: 244/0/0
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
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.
Requi is offline  
Old 09/22/2014, 11:57   #7
 
elite*gold: 0
Join Date: Sep 2014
Posts: 896
Received Thanks: 100
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
Ammy' is offline  
Old 09/22/2014, 15:33   #8

 
snow's Avatar
 
elite*gold: 724
Join Date: Mar 2011
Posts: 10,479
Received Thanks: 3,318
#closed (on request)
snow is offline  
Closed Thread




All times are GMT +2. The time now is 15:01.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.