Merge pull request #3199 from lambdageek/dev/proxy-setter
[mono.git] / mcs / tools / mono-symbolicate / StackTraceMetadata.cs
1 using System.Text.RegularExpressions;
2
3 namespace Mono
4 {
5         class StackTraceMetadata
6         {
7                 static Regex regex = new Regex (@"\[(?<Id>.+)\] (?<Value>.+)");
8
9                 public readonly string Id;
10                 public readonly string Value;
11                 public readonly string Line;
12
13                 private StackTraceMetadata (string line, string id, string val)
14                 {
15                         Line = line;
16                         Id = id;
17                         Value = val;
18                 }
19         
20                 public static bool TryParse (string line, out StackTraceMetadata metadata)
21                 {
22                         metadata = null;
23
24                         var match = regex.Match (line);
25                         if (!match.Success)
26                                 return false;
27
28                         string id = match.Groups ["Id"].Value;
29                         string val = match.Groups ["Value"].Value;
30
31                         metadata = new StackTraceMetadata (line, id, val);
32
33                         return true;
34                 }
35         }
36 }