Parser erkennt jetzt auch Werte ohne namen innerhalb von blöcken
This commit is contained in:
@@ -288,6 +288,7 @@ namespace WorldOfPeacecraft
|
|||||||
private string Name;
|
private string Name;
|
||||||
private LinkedList<Block> Blocks = new LinkedList<Block> ();
|
private LinkedList<Block> Blocks = new LinkedList<Block> ();
|
||||||
private Dictionary<String, String> Values = new Dictionary<String, String> ();
|
private Dictionary<String, String> Values = new Dictionary<String, String> ();
|
||||||
|
private string UnnamedValue;
|
||||||
|
|
||||||
public Block (String[] message, int start, int end)
|
public Block (String[] message, int start, int end)
|
||||||
{
|
{
|
||||||
@@ -310,13 +311,17 @@ namespace WorldOfPeacecraft
|
|||||||
begins++;
|
begins++;
|
||||||
}
|
}
|
||||||
Blocks.AddLast (new Block (message, blockstart, pos));
|
Blocks.AddLast (new Block (message, blockstart, pos));
|
||||||
} else {
|
} else if (message[pos].Contains(":")) {
|
||||||
// It's a value
|
// It's a value
|
||||||
string name = StringUtils.SubstringBefore (message [pos], ":");
|
string name = StringUtils.SubstringBefore (message [pos], ":");
|
||||||
string val = StringUtils.SubstringAfter (message [pos], ":");
|
string val = StringUtils.SubstringAfter (message [pos], ":");
|
||||||
Values [name] = val;
|
Values [name] = val;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
UnnamedValue = message[pos];
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,6 +330,11 @@ namespace WorldOfPeacecraft
|
|||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetUnnamedValue()
|
||||||
|
{
|
||||||
|
return UnnamedValue;
|
||||||
|
}
|
||||||
|
|
||||||
public LinkedList<Block> GetBlocks ()
|
public LinkedList<Block> GetBlocks ()
|
||||||
{
|
{
|
||||||
return Blocks;
|
return Blocks;
|
||||||
|
|||||||
Reference in New Issue
Block a user