public static void Analyze(Task task) { Folder analyzerReport = null; Folder parent = null; foreach (var message in task.Children.OfType <Message>().ToArray()) { var text = message.Text; if (text.StartsWith(Strings.TotalAnalyzerExecutionTime)) { analyzerReport = new Folder(); analyzerReport.Name = Strings.AnalyzerReport; task.AddChild(analyzerReport); parent = analyzerReport; } else if (text.Contains(", Version=") && analyzerReport != null) { var lastAssembly = new Folder(); lastAssembly.Name = text; analyzerReport.AddChild(lastAssembly); parent = lastAssembly; } if (parent != null) { message.Parent.Children.Remove(message); parent.AddChild(message); } } }
public static Folder Analyze(Task task) { Folder analyzerReport = null; Folder parent = null; foreach (var message in task.Children.OfType <Message>().ToArray()) { var text = message.Text; if (text.StartsWith(Strings.TotalAnalyzerExecutionTime, StringComparison.Ordinal)) { analyzerReport = new Folder(); analyzerReport.Name = Strings.AnalyzerReport; task.AddChild(analyzerReport); parent = analyzerReport; } else if (text.Contains(", Version=") && analyzerReport != null) { var lastAssembly = new Folder(); lastAssembly.Name = text; analyzerReport.AddChild(lastAssembly); parent = lastAssembly; // Remove the message since we are already using the same text for the containing folder message.Parent.Children.Remove(message); continue; } if (parent != null) { message.Parent.Children.Remove(message); parent.AddChild(message); } } return(analyzerReport); }