Exemple #1
0
        /// <summary>
        /// Finds the proper text to be used for a tree node
        /// </summary>
        /// <param name="node"> node to find name for </param>
        /// <returns>name of the node to display on tree </returns>
        public static string TextSelector(Object node)
        {
            if (node is ProxyNode)
            {
                node = ((ProxyNode)node).Original;
            }
            string text = node switch
            {
                Project p => p.Name,
                Target t => "Target " + t.Name,
                Folder f => f.Name,
                ProjectEvaluation pe => pe.Name,
                   Microsoft.Build.Logging.StructuredLogger.Task ta => "Task " + ta.Title + " duration " + ta.DurationText,
                AddItem a => "Add Item " + a.Name,
                RemoveItem r => "Remove Item " + r.Name,
                Item i => i.NameAndEquals + " " + i.ShortenedText,
                Metadata m => m.NameAndEquals + " " + m.ShortenedValue,
                EvaluationProfileEntry epe => epe.Title + " " + epe.DurationText + " " + epe.ShortenedElementDescription,
                Property p => p.NameAndEquals + " " + p.ShortenedValue,
                Parameter p => p.Name,
                Message m => m.ShortenedText,
                Import i => "Import " + i.Name + " " + i.Location,
                NoImport ni => "NoImport " + ni.Name + " " + ni.Location + " " + ni.Text,
                Error e => e.ToString(),
                Warning w => w.ToString(),
                Note n => n.Text,
                SourceFile sf => sf.Name,
                SourceFileLine sfl => sfl.LineNumber + " " + sfl.LineText,
                ProxyNode pn => pn.TypeName,
                TimedNode t => t.Name,
                   _ => node.ToString()
            };

            return(text);
        }
Exemple #2
0
 /// <summary>
 /// Adds the given task as a child node.
 /// </summary>
 /// <param name="task">The task to add.</param>
 public void AddChildTask(Task task)
 {
     AddChildNode(task);
 }