Nemerle.VisualStudio.Project.NemerleProjectNode.ProcessFiles C# (CSharp) Method

ProcessFiles() protected method

Loads file items from the project file into the hierarchy.
protected ProcessFiles ( ) : void
return void
        protected internal override void ProcessFiles()
        {
            List<String> subitemsKeys = new List<String>();
            var subitems = new Dictionary<String, MSBuild.ProjectItem>();

            // Define a set for our build items. The value does not really matter here.
            var items = new Dictionary<String, MSBuild.ProjectItem>();

            // Process Files
            var projectFiles = BuildProject.AllEvaluatedItems;

            foreach (var item in projectFiles)
            {
                // Ignore the item if it is a reference or folder
                if (this.FilterItemTypeToBeAddedToHierarchy(item.ItemType))
                    continue;

                // MSBuilds tasks/targets can create items (such as object files),
                // such items are not part of the project per say, and should not be displayed.
                // so ignore those items.
                if (!this.IsItemTypeFileType(item.ItemType))
                    continue;

                // If the item is already contained do nothing.
                // TODO: possibly report in the error list that the the item is already contained in the project file similar to Language projects.
                if (items.ContainsKey(item.EvaluatedInclude.ToUpperInvariant()))
                    continue;

                // Make sure that we do not want to add the item, dependent, or independent twice to the ui hierarchy
                items.Add(item.EvaluatedInclude.ToUpperInvariant(), item);

                string dependentOf = item.GetMetadataValue(ProjectFileConstants.DependentUpon);

                if (!this.CanFileNodesHaveChilds || String.IsNullOrEmpty(dependentOf))
                    AddIndependentFileNode(item);
                else
                {
                    // We will process dependent items later.
                    // Note that we use 2 lists as we want to remove elements from
                    // the collection as we loop through it
                    subitemsKeys.Add(item.EvaluatedInclude);
                    subitems.Add(item.EvaluatedInclude, item);
                }
            }

            // Now process the dependent items.
            if (this.CanFileNodesHaveChilds)
                ProcessDependentFileNodes(subitemsKeys, subitems);
        }