private TreeNode FindParent(BuildEventContext buildEventContext)
        {
            TreeNode result = null;

            if (buildEventContext.ProjectContextId == -2)
            {
                var evaluationId = buildEventContext.EvaluationId;

                result = EvaluationFolder;

                var projectEvaluation = result.FindChild <ProjectEvaluation>(p => p.Id == evaluationId);
                if (projectEvaluation != null)
                {
                    result = projectEvaluation;
                }

                return(result);
            }

            Project project = GetOrAddProject(buildEventContext.ProjectContextId);

            result = project;
            if (buildEventContext.TargetId > 0)
            {
                var target = project.GetTargetById(buildEventContext.TargetId);
                if (target != null)
                {
                    result = target;
                    if (buildEventContext.TaskId > 0)
                    {
                        var task = target.GetTaskById(buildEventContext.TaskId);
                        if (task != null)
                        {
                            result = task;
                        }
                    }
                }
            }

            return(result);
        }
示例#2
0
        private TreeNode FindParent(BuildEventContext buildEventContext)
        {
            Project  project = GetOrAddProject(buildEventContext.ProjectContextId);
            TreeNode result  = project;

            if (buildEventContext.TargetId > 0)
            {
                var target = project.GetTargetById(buildEventContext.TargetId);
                if (target != null)
                {
                    result = target;
                    if (buildEventContext.TaskId > 0)
                    {
                        var task = target.GetTaskById(buildEventContext.TaskId);
                        if (task != null)
                        {
                            result = task;
                        }
                    }
                }
            }

            return(result);
        }