e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
37 lines
713 B
C#
37 lines
713 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace Mono
|
|
{
|
|
class StackTraceMetadata
|
|
{
|
|
static Regex regex = new Regex (@"\[(?<Id>.+)\] (?<Value>.+)");
|
|
|
|
public readonly string Id;
|
|
public readonly string Value;
|
|
public readonly string Line;
|
|
|
|
private StackTraceMetadata (string line, string id, string val)
|
|
{
|
|
Line = line;
|
|
Id = id;
|
|
Value = val;
|
|
}
|
|
|
|
public static bool TryParse (string line, out StackTraceMetadata metadata)
|
|
{
|
|
metadata = null;
|
|
|
|
var match = regex.Match (line);
|
|
if (!match.Success)
|
|
return false;
|
|
|
|
string id = match.Groups ["Id"].Value;
|
|
string val = match.Groups ["Value"].Value;
|
|
|
|
metadata = new StackTraceMetadata (line, id, val);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|