المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Readig strings from a text file ?



C# Programming
06-13-2009, 12:30 AM
Guys i have a text file that i store my settings in so that they are availible in every forum .

basicly its in the following format


//The shared NAS download folder
DownloadFolder = /mnt/md1/public/Downloads/

//The telnet user usualy root
TelnetUser = root

//The telnet password
TelnetPassword = something

//The IP of your NAS eg 192.168.2.2
TelnetIP = 192.168.2.2

So im looking for a way to take each of those settings and turn them into strings with values inside my c# program . Im useing the stream reader class below but im not sure what to do next after i split the strings into an array .

private void LoadSettings()
{
StreamReader Settings = new StreamReader("Settings.txt");
string line;
while ((line = Settings.ReadLine()) != null)
{
if (line.StartsWith("/"))
{
}
else
{
string[] splitArray = line.Split(new char[] { '=' });


}
}