Esempio n. 1
0
        private void PostAnalyzeProject(Project project)
        {
            // if nothing in the project is important, mark the project as not important as well
            if (project.HasChildren)
            {
                bool allLowRelevance = true;

                var entryTargets = project.FindChild <Folder>(Strings.EntryTargets);
                if (entryTargets != null)
                {
                    if (entryTargets.Children.OfType <IHasRelevance>().All(c => c.IsLowRelevance))
                    {
                        entryTargets.IsLowRelevance = true;
                    }
                }

                foreach (var child in project.Children)
                {
                    if (child is IHasRelevance hasRelevance)
                    {
                        if (!hasRelevance.IsLowRelevance)
                        {
                            allLowRelevance = false;
                            break;
                        }
                    }
                    else
                    {
                        allLowRelevance = false;
                        break;
                    }
                }

                if (allLowRelevance)
                {
                    project.IsLowRelevance = true;
                }
            }

            if (string.IsNullOrEmpty(project.TargetFramework))
            {
                var evaluation = build.FindEvaluation(project.EvaluationId);
                if (evaluation != null)
                {
                    project.TargetFramework = evaluation.TargetFramework;
                    if (!string.IsNullOrEmpty(project.TargetFramework))
                    {
                        var text = $"Properties and items are available at evaluation id:{project.EvaluationId}. Use the hyperlink above or the new 'Properties and items' tab.";
#if DEBUG
                        text = build.StringTable.Intern(text);
#endif
                        project.AddChildAtBeginning(new Note
                        {
                            Text = text
                        });
                    }
                }
            }
        }