Пример #1
0
 private static void DrillDownInProjectItems(ProjectItems projectItems, Review review, ProcessProjectItemScanResult psr, out bool found)
 {
     found = false;
     ProjectItems projItems;
     ProjectItem projectItem = projectItems.Parent as ProjectItem;
     //Check if the parent itself matches before searching for the parent's children.
     if (projectItem.Name == review.File)
     {
         psr.Invoke(projectItem, review);
         found = true;
         return;
     }
     foreach (ProjectItem projItem in projectItems)
     {
         projItems = projItem.ProjectItems;
         if ((projItems != null
              && (projItems.Count > 0)))
         {
             //  recurse to get to the bottom of the tree
             DrillDownInProjectItems(projItems, review, psr, out found);
             if (found)
             {
                 return;
             }
         }
         else if (projItem.Name == review.File && projItem.ContainingProject.Name == review.Project)
         {
             //  call back to the user function delegated to
             //  handle a single project item
             psr.Invoke(projItem, review);
             found = true;
             return;
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Scans for project items.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="review">The review.</param>
        /// <param name="processProjectItemScanResult">The PSR.</param>
        /// <param name="itemFound">if set to <c>true</c> [item found].</param>
        public static void ScanForProjectItems(Project project, Review review, ProcessProjectItemScanResult processProjectItemScanResult, out bool itemFound)
        {
            ProjectItems projItems;

            foreach (ProjectItem projItem in project.ProjectItems)
            {
                projItems = projItem.ProjectItems;
                if ((projItems != null &&
                     (projItems.Count > 0)))
                {
                    bool found;
                    DrillDownInProjectItems(projItems, review, processProjectItemScanResult, out found);
                    if (found)
                    {
                        itemFound = true;
                        return;
                    }
                }
                else if (projItem.SubProject != null)
                {
                    //try to find the item from project under solutoin folders
                    projItems = projItem.SubProject.ProjectItems;
                    if ((projItems != null &&
                         (projItems.Count > 0)))
                    {
                        bool found;
                        DrillDownInProjectItems(projItems, review, processProjectItemScanResult, out found);
                        if (found)
                        {
                            itemFound = true;
                            return;
                        }
                    }
                }
                else if (projItem.Name == review.File && projItem.ContainingProject.Name == review.Project)
                {
                    //  call back to the user function delegated to
                    //  handle a single project item
                    processProjectItemScanResult.Invoke(projItem, review);
                    itemFound = true;
                    return;
                }
            }
            itemFound = false;
        }
Пример #3
0
 /// <summary>
 /// Scans for project items.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="review">The review.</param>
 /// <param name="processProjectItemScanResult">The PSR.</param>
 /// <param name="itemFound">if set to <c>true</c> [item found].</param>
 public static void ScanForProjectItems(Project project, Review review, ProcessProjectItemScanResult processProjectItemScanResult, out bool itemFound)
 {
     ProjectItems projItems;
     foreach (ProjectItem projItem in project.ProjectItems)
     {
         projItems = projItem.ProjectItems;
         if ((projItems != null
              && (projItems.Count > 0)))
         {
             bool found;
             DrillDownInProjectItems(projItems, review, processProjectItemScanResult, out found);
             if (found)
             {
                 itemFound = true;
                 return;
             }
         }
         else if (projItem.SubProject != null)
         {
             //try to find the item from project under solutoin folders
             projItems = projItem.SubProject.ProjectItems;
             if ((projItems != null
                  && (projItems.Count > 0)))
             {
                 bool found;
                 DrillDownInProjectItems(projItems, review, processProjectItemScanResult, out found);
                 if (found)
                 {
                     itemFound = true;
                     return;
                 }
             }
         }
         else if (projItem.Name == review.File && projItem.ContainingProject.Name == review.Project)
         {
             //  call back to the user function delegated to
             //  handle a single project item
             processProjectItemScanResult.Invoke(projItem, review);
             itemFound = true;
             return;
         }
     }
     itemFound = false;
 }
Пример #4
0
        private static void DrillDownInProjectItems(ProjectItems projectItems, Review review, ProcessProjectItemScanResult psr, out bool found)
        {
            found = false;
            ProjectItems projItems;
            ProjectItem  projectItem = projectItems.Parent as ProjectItem;

            //Check if the parent itself matches before searching for the parent's children.
            if (projectItem.Name == review.File)
            {
                psr.Invoke(projectItem, review);
                found = true;
                return;
            }
            foreach (ProjectItem projItem in projectItems)
            {
                projItems = projItem.ProjectItems;
                if ((projItems != null &&
                     (projItems.Count > 0)))
                {
                    //  recurse to get to the bottom of the tree
                    DrillDownInProjectItems(projItems, review, psr, out found);
                    if (found)
                    {
                        return;
                    }
                }
                else if (projItem.Name == review.File && projItem.ContainingProject.Name == review.Project)
                {
                    //  call back to the user function delegated to
                    //  handle a single project item
                    psr.Invoke(projItem, review);
                    found = true;
                    return;
                }
            }
        }