static void PrettyPrint(TextWriter writer, IAnalysisItemView item, string currentIndent, string indent) { var stack = new Stack <IAnalysisItemView>(); var seen = new HashSet <IAnalysisItemView>(); stack.Push(item); while (stack.Any()) { var i = stack.Pop(); if (i == null) { currentIndent = currentIndent.Remove(0, indent.Length); continue; } IEnumerable <IAnalysisItemView> exportChildren; i.ExportToTree(writer, currentIndent, indent, out exportChildren); if (exportChildren != null && seen.Add(i)) { stack.Push(null); foreach (var child in exportChildren.Reverse()) { stack.Push(child); } currentIndent += indent; } } }
static void PrettyPrint(TextWriter writer, IAnalysisItemView item, string currentIndent, string indent) { var stack = new Stack<IAnalysisItemView>(); var seen = new HashSet<IAnalysisItemView>(); stack.Push(item); while (stack.Any()) { var i = stack.Pop(); if (i == null) { currentIndent = currentIndent.Remove(0, indent.Length); continue; } IEnumerable<IAnalysisItemView> exportChildren; i.ExportToTree(writer, currentIndent, indent, out exportChildren); if (exportChildren != null && seen.Add(i)) { stack.Push(null); foreach (var child in exportChildren.Reverse()) { stack.Push(child); } currentIndent += indent; } } }