2 using System.Collections.Generic;
15 foreach (
string D
in DataToParse)
17 int TP = D.IndexOf(
",");
20 string TableName = D.Substring(0, TP).Trim();
21 if (!ContainsKey(TableName))
25 string VD = D.Substring(TP + 1).Trim();
29 while (Pos < VD.Length)
31 Pos = VD.IndexOf(
'=', LastPos);
33 if (Pos - LastPos < 1)
35 Log.
Warning(
"Will skip some variable definitions due to missing variable name before = in line {0}".Build(D));
38 string VarName = VD.Substring(LastPos, Pos - LastPos).Trim();
48 Pos = VD.IndexOf(
'}', LastPos);
51 Log.
Warning(
"Will skip some variable definitions due to missing closing } bracket in line {0}".Build(D));
54 Value = VD.Substring(LastPos + 1, Pos - LastPos - 1);
57 while (Pos < VD.Length && VD[Pos] ==
' ')
66 Log.
Warning(
"Will skip some variable definitions due to missing / after } in line {0}".Build(D));
74 Pos = VD.IndexOf(
'/', LastPos);
79 Value = VD.Substring(LastPos, Pos - LastPos).Trim();
83 if (!
this[TableName].ContainsKey(VarName))
85 this[TableName].Add(VarName, Value);
90 Log.
Warning(
"Variable {0} has been defined more than once in line {1}.".Build(VarName, D));
102 Log.
Warning(
"Could not find comma in TableVariables section line {0}.".Build(D));
TableVariablesDictionary(List< string > DataToParse)
static void Warning(string Message)
Writes a warning message to the log.
A simple logger used to record important events and exceptions.
TableVariablesDictionary()