private List<XmlElement> ParseBacktrace(XmlDocument doc, string stack)
{
List<XmlElement> backtrace = new List<XmlElement>();
string[] lines = Regex.Split(stack, "\r\n");
foreach (string line in lines)
{
XmlElement l = doc.CreateElement("line");
string number = Regex.Match(line, @":line \d+").Value.Replace(":line", string.Empty);
string file = Regex.Match(line, @"in (.*):").Value.Replace("in ", string.Empty).Replace(":", string.Empty);
string method = Regex.Match(line, @"at .*\)").Value.Replace("at ", string.Empty);
if (!string.IsNullOrEmpty(number))
{
l.SetAttribute("number", number);
}
if (!string.IsNullOrEmpty(file))
{
l.SetAttribute("file", file);
}
if (!string.IsNullOrEmpty(method))
{
l.SetAttribute("method", method);
}
backtrace.Add(l);
}
return backtrace;
}