1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
public string GetValueFromIni(string key, string iniFilePath)
{
string keyValue = null;
string line = null;
using (FileStream filestream = new FileStream(iniFilePath, FileMode.Open, FileAccess.Read))
{
using (StreamReader reader = new StreamReader(filestream))
{
while (!reader.EndOfStream)
{
line = reader.ReadLine();
if (line.StartsWith(key))
{
keyValue = line.Substring(line.IndexOf('=') + 1);
}
}
}
}
return keyValue;
}
|