29 using System.Text.RegularExpressions;
36 namespace OpenSim.Data
45 _iniKeyValuePatternRegex =
new Regex(
46 @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]*
47 # key part (surrounding whitespace stripped)
49 (\s)*(?<Value>([^\n^\s]+(\n){0,1})))
50 # value part (surrounding whitespace stripped)
52 RegexOptions.IgnorePatternWhitespace |
53 RegexOptions.Compiled |
54 RegexOptions.CultureInvariant);
57 private static Regex _iniKeyValuePatternRegex;
61 _iniFileName = iniFileName;
66 using (StreamReader reader =
67 new StreamReader(_iniFileName))
71 string line = reader.ReadLine();
73 _iniKeyValuePatternRegex.Match(line);
77 match.Groups[
"Key"].Value as string;
78 if (currentKey != null &&
79 currentKey.Trim().CompareTo(
key) == 0)
82 match.Groups[
"Value"].Value as string;
86 }
while (reader.Peek() != -1);
91 public string IniFileName
93 get {
return _iniFileName; }
96 private string _iniFileName;
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
Parse settings from ini-like files
string ParseFileReadValue(string key)
IniFile(string iniFileName)