mirror of
https://github.com/GittyMac/A1Emu.git
synced 2026-08-25 10:34:15 -05:00
Update A1_Parser with descendant parsing.
This commit is contained in:
@@ -53,6 +53,19 @@ public class A1_Parser
|
||||
commandInfo.Add(value);
|
||||
}
|
||||
|
||||
//Allows parsing of descendant elements.
|
||||
foreach(XElement element in commandRoot.Descendants()){
|
||||
var desAttrNames = (
|
||||
from a in element.Attributes()
|
||||
select a.Value
|
||||
);
|
||||
|
||||
foreach (string value in desAttrNames)
|
||||
{
|
||||
commandInfo.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
if (routingString != "")
|
||||
{
|
||||
string[] routingData = routingString.Split("|");
|
||||
@@ -65,4 +78,29 @@ public class A1_Parser
|
||||
return commandInfo.ToArray();
|
||||
}
|
||||
|
||||
//Gets the Routing String from the command.
|
||||
public string[] ParseRoutingStrings(string command)
|
||||
{
|
||||
|
||||
List<string> routeInfo = new List<string>();
|
||||
string routingString = "";
|
||||
|
||||
if (command.EndsWith("#"))
|
||||
{
|
||||
routingString = command.Substring(command.LastIndexOf(">") + 1, command.LastIndexOf("#") - command.LastIndexOf(">") - 1);
|
||||
command = command.Substring(0, command.LastIndexOf(">") + 1);
|
||||
}
|
||||
|
||||
if (routingString != "")
|
||||
{
|
||||
string[] routingData = routingString.Split("|");
|
||||
foreach (string routeID in routingData)
|
||||
{
|
||||
routeInfo.Add(routeID);
|
||||
}
|
||||
}
|
||||
|
||||
return routeInfo.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user