public static FileTrace Parse(StreamReader Reader) { var trace = new FileTrace(); var Text = Reader.ReadToEnd(); trace.RawText = Text; var functions = Text.Split(new string[] { "--------------------------------Start\n", "--------------------------------End\n", }, StringSplitOptions.RemoveEmptyEntries); foreach (var f in functions) { var call = new TracedFunctionCall() { Name = Regex.Match(f, @"Function Called:\s(.+)\n").Groups[1].Value }; var matches = Regex.Matches(f, @"\$Param\d+:\s(((?!(\$Param\d+:\s)|(Value:\s)|(-{32,}End))[\s\S])+)\n", RegexOptions.Multiline); foreach (Match m in matches) { call.ParameterValues.Add(m.Groups[1].Value); } Match valueMatch = Regex.Match(f, @"Value:\s(.+)\n"); if (valueMatch.Success) { call.Value = valueMatch.Groups[1].Value; } trace.Calls.Add(call); } return(trace); }
public static FileTrace Parse(StreamReader Reader) { var trace = new FileTrace(); var Text = Reader.ReadToEnd(); trace.RawText = Text; var functions = Text.Split(new string[] { "--------------------------------Start\n", "--------------------------------End\n", }, StringSplitOptions.RemoveEmptyEntries); foreach (var f in functions) { var call = new TracedFunctionCall() { Name = Regex.Match(f, @"Function Called:\s(.+)\n").Groups[1].Value }; var matches = Regex.Matches(f, @"\$Param\d+:\s(((?!(\$Param\d+:\s)|(Value:\s)|(-{32,}End))[\s\S])+)\n", RegexOptions.Multiline); foreach (Match m in matches) call.ParameterValues.Add(m.Groups[1].Value); Match valueMatch = Regex.Match(f, @"Value:\s(.+)\n"); if (valueMatch.Success) call.Value = valueMatch.Groups[1].Value; trace.Calls.Add(call); } return trace; }