private static void WriteNode(BaseNode rootNode, StringBuilder sb, int indent = 0) { if (rootNode == null) { return; } Indent(sb, indent); var text = rootNode.ToString() ?? ""; // when we injest strings we normalize on \n to save space. // when the strings leave our app via clipboard, bring \r\n back so that notepad works text = text.Replace("\n", "\r\n"); sb.AppendLine(text); var treeNode = rootNode as TreeNode; if (treeNode != null && treeNode.HasChildren) { foreach (var child in treeNode.Children) { WriteNode(child, sb, indent + 1); } } }
public string GetNodeText(BaseNode node) { if (node is Target t) { return(t.Name); } return(node.ToString()); }
public static string GetNodeText(BaseNode node) { if (node is Target t) { return(t.Name); } else if (node is Project project) { return($"{project.Name} {project.TargetFramework}{project.TargetsDisplayText}"); } else if (node is ProjectEvaluation evaluation) { return($"{evaluation.Name} {evaluation.EvaluationText}"); } return(node.ToString()); }