当前位置: 首页>>代码示例>>C#>>正文


C# ProjectItems类代码示例

本文整理汇总了C#中ProjectItems的典型用法代码示例。如果您正苦于以下问题:C# ProjectItems类的具体用法?C# ProjectItems怎么用?C# ProjectItems使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectItems类属于命名空间,在下文中一共展示了ProjectItems类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindProjectInternal

    static void FindProjectInternal(ProjectItems items, List<Project> projectList)
    {
        if (items == null)
        {
            return;
        }

        foreach (ProjectItem item in items)
        {
            Project project;
            if (item.SubProject != null)
            {
                project = item.SubProject;
            }
            else
            {
                project = item.Object as Project;
            }
            if (project != null)
            {
                if (ProjectKind.IsSupportedProjectKind(project.Kind))
                {
                    projectList.Add(project);
                }
                FindProjectInternal(project.ProjectItems, projectList);
            }
        }
    }
开发者ID:paulcbetts,项目名称:Fody,代码行数:28,代码来源:AllProjectFinder.cs

示例2: DrillDownInProjectItems

 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;
         }
     }
 }
开发者ID:vendettamit,项目名称:ReviewPal,代码行数:35,代码来源:VSIDEHelper.cs

示例3: CopyProjectItems

 private static void CopyProjectItems(ProjectItems sourceItems, ProjectItems targetItems)
 {
     foreach (ProjectItem projectItem in sourceItems)
     {
         ProjectItem tempItem = null;
         try
         {
             tempItem = targetItems.Item(projectItem.Name);
         }
         catch (ArgumentException)
         {
             if (projectItem.Kind == "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}")
             {
                 if (projectItem.Name != "Properties")
                 {
                     tempItem = targetItems.AddFolder(projectItem.Name);
                 }
             }
             else if (projectItem.Name != "packages.config")
             {
                 tempItem = targetItems.AddFromFile(projectItem.Properties.Item("LocalPath").Value as string);
             }
         }
         if (tempItem != null)
         {
             CopyProjectItems(projectItem.ProjectItems, tempItem.ProjectItems);
         }
     }
 }
开发者ID:cgoconseils,项目名称:XrmFramework,代码行数:29,代码来源:ProjectHelper.cs

示例4: GetAllProjectItemsRecursive

        public IEnumerable<ProjectItem> GetAllProjectItemsRecursive(ProjectItems projectItems)
        {
            foreach (ProjectItem projectItem in projectItems)
            {
                if (projectItem == null)
                {
                    continue;
                }

                if (projectItem.ProjectItems != null)
                {
                    foreach (ProjectItem subItem in GetAllProjectItemsRecursive(projectItem.ProjectItems))
                    {
                        // INFO: We only want real files, not folders etc.
                        // http://msdn.microsoft.com/en-us/library/z4bcch80%28v=vs.80%29.aspx
                        if (subItem.Kind == "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}")
                        {
                            yield return subItem;
                        }
                    }
                }

                // INFO: We only want real files, not folders etc.
                // http://msdn.microsoft.com/en-us/library/z4bcch80%28v=vs.80%29.aspx
                if (projectItem.Kind == "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}")
                {
                    yield return projectItem;
                }
            }
        }
开发者ID:officeclip1,项目名称:FindUnusedFiles,代码行数:30,代码来源:VSFindUnusedFilesPackage.cs

示例5: CheckProjectItemsRecursive

 private static ProjectItem CheckProjectItemsRecursive(ProjectItems projectItems, string path)
 {
     foreach (ProjectItem projectItem in projectItems)
     {
         if (projectItem.ProjectItems != null && projectItem.ProjectItems.Count > 0)
         {
             var x = CheckProjectItemsRecursive(projectItem.ProjectItems, path);
             if (x != null)
             {
                 return x;
             }
         }
         for (short i = 1; i <= projectItem.FileCount; i++)
         {
             try
             {
                 var filename = projectItem.FileNames[i];
                 if (filename != null)
                 {
                     if (filename.ToLower() == path)
                     {
                         return projectItem;
                     }
                 }
             }
             catch(Exception ex)
             {
                 
             }
         }
     }
     return null;
 }
开发者ID:jeroldhaas,项目名称:ContinuousTests,代码行数:33,代码来源:CodeModelCache.cs

示例6: AllProjectItemsRecursive

		static IEnumerable<ProjectItem> AllProjectItemsRecursive(ProjectItems projectItems)
		{
			if (projectItems == null)
				yield break;

			foreach (ProjectItem projectItem in projectItems)
			{
				if (projectItem.IsFolder() && projectItem.ProjectItems != null)
				{
					foreach (var folderProjectItem in AllProjectItemsRecursive(projectItem.ProjectItems))
					{
						yield return folderProjectItem;
					}
				}
				else if (projectItem.IsSolutionFolder())
				{
					foreach (var solutionProjectItem in AllProjectItemsRecursive(projectItem.SubProject.ProjectItems))
					{
						yield return solutionProjectItem;
					}
				}
				else
				{
					yield return projectItem;
				}
			}
		}
开发者ID:jamesfoster,项目名称:ChirpyMEF,代码行数:27,代码来源:ProjectItemManager.cs

示例7: CreateFileList

        /// <summary>
        /// Generate a list of all files included in the Visual Studio solutions.
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="projectItems"></param>
        /// <param name="fileDetails"></param>
        private void CreateFileList(string projectName, ProjectItems projectItems, ref List<FileDetails> fileDetails)
        {
            foreach (ProjectItem projItem in projectItems)
            {
                if (projItem.ProjectItems != null && projItem.ProjectItems.Count > 0)
                {
                    // This is a sub project...
                    CreateFileList(projectName, projItem.ProjectItems, ref fileDetails);
                }

                if (projItem.Kind == Constants.vsProjectItemKindPhysicalFile)
                {
                    string entirePathAndFile = projItem.Properties.Item("FullPath").Value as string;

                    string fileName = Path.GetFileName(entirePathAndFile);
                    string path = Path.GetDirectoryName(entirePathAndFile);

                    FileDetails details = new FileDetails();

                    details.FileName = fileName;
                    details.Path = path;
                    details.Project = projectName;

                    fileDetails.Add(details);
                }
            }
        }
开发者ID:martinknafve,项目名称:incrementalfileopener,代码行数:33,代码来源:AddinApplication.cs

示例8: AddFiles

        private static void AddFiles(Project project, ProjectItems items, Document currentDoc)
        {
            foreach (ProjectItem subItem in items)
            {
                if (currentDoc == subItem)
                    continue;

                if (subItem.Kind == PhysicalFolderKind || subItem.Kind == VirtualFolderKind)
                    AddFiles (project, subItem.ProjectItems, currentDoc);
                else if (subItem.Kind == PhysicalFileKind)
                {
                    if (subItem.Name.EndsWith (".cs")) // HACK: Gotta be a better way to know if it's C#.
                    {
                        for (short i = 0; i < subItem.FileCount; i++)
                        {
                            string path = subItem.FileNames[i];
                            if (path == currentDoc.FullName)
                                continue;

                            project.Sources.Add (Either<FileInfo, string>.A (new FileInfo (path)));
                        }
                    }
                }
            }
        }
开发者ID:ermau,项目名称:Instant,代码行数:25,代码来源:VisualStudioExtensions.cs

示例9: FilesFromProjectItems

        private List<string> FilesFromProjectItems(ProjectItems projectItems, string path)
        {
            if (projectItems == null)
                return null;

            List<string> result = new List<string>();

            foreach (ProjectItem item in projectItems)
            {
                if (item.Kind == ProjectItemKind.PhysicalFile)
                {
                    if (item.Name.EndsWith(".js", StringComparison.InvariantCultureIgnoreCase) == true)
                    {
                        result.Add(item.FileNames[0]);
                    }
                }
                else if (item.Kind == ProjectItemKind.PhysicalFolder || item.Kind == ProjectItemKind.VirtualFolder)
                {
                    List<string> files = FilesFromProjectItems(item.ProjectItems, path + "\\" + item.Name );
                    result.AddRange(files);
                }
            }

            return result;
        }
开发者ID:MiguelCastillo,项目名称:jsCompiler,代码行数:25,代码来源:DTE.cs

示例10: FindProjectItem

        public static ProjectItem FindProjectItem(ProjectItems items, string file)
        {
            var atom = file.Substring(0, file.IndexOf("\\") + 1);

            foreach (ProjectItem item in items)
            {
                if (atom.StartsWith(item.Name))
                {
                    // then step in
                    var ritem = FindProjectItem(item.ProjectItems, file.Substring(file.IndexOf("\\") + 1));

                    if (ritem != null)
                        return ritem;
                }

                if (Regex.IsMatch(item.Name, file))
                    return item;

                if (item.ProjectItems.Count > 0)
                {
                    ProjectItem ritem = FindProjectItem(item.ProjectItems, file.Substring(file.IndexOf("\\") + 1));
                    if (ritem != null)
                        return ritem;
                }
            }
            return null;
        }
开发者ID:geckosoft,项目名称:GaspXP,代码行数:27,代码来源:VsHelper.cs

示例11: GetAllProjects

        private static IEnumerable<Project> GetAllProjects(ProjectItems projectItems)
        {
            if(projectItems == null)
                yield break;

            foreach(var projectItem in projectItems.Cast<ProjectItem>())
            {
                if(projectItem.SubProject != null)
                {
                    yield return projectItem.SubProject;

                    foreach(var project in GetAllProjects(projectItem.SubProject))
                    {
                        yield return project;
                    }
                }
                else
                {
                    foreach(var project in GetAllProjects(projectItem.ProjectItems))
                    {
                        yield return project;
                    }
                }
            }
        }
开发者ID:HansKindberg-Lab,项目名称:VisualStudio-Templates,代码行数:25,代码来源:SolutionExtension.cs

示例12: FindProjectItem

        /// <summary>
        /// Find the first project item with the given filename.
        /// </summary>
        /// <param name="projectItems">
        /// The list of project items to inspect recursively.
        /// </param>
        /// <param name="filename">
        /// The name of the project item to find.
        /// </param>
        /// <param name="recurse">
        /// Whether to recurse into project items.  Optional, true by default.
        /// </param>
        /// <returns>
        /// Returns the first project item with the given filename.
        /// </returns>
        public static ProjectItem FindProjectItem(ProjectItems projectItems, string filename, bool recurse = true)
        {
            if (projectItems == null)
            {
                return null;
            }

            foreach (ProjectItem item in projectItems)
            {
                if (string.Equals(item.Name, filename, StringComparison.OrdinalIgnoreCase))
                {
                    return item;
                }
                else if (recurse && item.ProjectItems != null)
                {
                    var subItem = ProjectUtilities.FindProjectItem(item.ProjectItems, filename);
                    if (subItem != null)
                    {
                        return subItem;
                    }
                }
            }

            return null;
        }
开发者ID:Azure,项目名称:azure-iot-hub-vs-cs,代码行数:40,代码来源:ProjectUtilities.cs

示例13: CheckThatTTOutputIsNotUnderSCC

 private void CheckThatTTOutputIsNotUnderSCC(DTE service, Project project, ProjectItems projectItems)
 {
     foreach (ProjectItem childItem in projectItems)
     {
         if (childItem.Name.EndsWith(".tt"))
         {
             //ok, tt-File found, check, if the child is under source control
             if (childItem.ProjectItems.Count > 0)
             {
                 foreach (ProjectItem ttOutputItem in childItem.ProjectItems)
                 {
                     string itemname = Helpers.GetFullPathOfProjectItem(ttOutputItem); // ttOutputHelpers.GetFullPathOfProjectItem(item);
                     if(service.SourceControl.IsItemUnderSCC(itemname))
                     {
                         Helpers.LogMessage(service, this, "Warning: File " + itemname + " should not be under source control");
                         if (MessageBox.Show("Warning: File " + itemname + " should not be under source control. " + Environment.NewLine + Environment.NewLine + "Exclude file from source control?", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
                         {
                             Helpers.ExcludeItemFromSCC(service, project, ttOutputItem);
                             solved++;
                         }
                         else
                         {
                             ignored++;
                         }
                     }
                 }
             }
         }
         CheckThatTTOutputIsNotUnderSCC(service, project, childItem.ProjectItems);
     }
 }
开发者ID:sunday-out,项目名称:SharePoint-Software-Factory,代码行数:31,代码来源:AnalyzeSelectedProjects.cs

示例14: FindProjectInternal

    static void FindProjectInternal(ProjectItems items, List<Project> projectList)
    {
        if (items == null)
        {
            return;
        }

        foreach (ProjectItem item in items)
        {
            try
            {
                var project = item.SubProject;
                if (project == null)
                {
                    project = item.Object as Project;
                }
                if (project != null)
                {
                    if (ProjectKind.IsSupportedProjectKind(project.Kind))
                    {
                        projectList.Add(project);
                    }
                    FindProjectInternal(project.ProjectItems, projectList);
                }
            }
            catch (NotImplementedException)
            {
            }
            catch (NullReferenceException)
            {
            }
        }
    }
开发者ID:chantsunman,项目名称:NotifyPropertyWeaver,代码行数:33,代码来源:AllProjectFinder.cs

示例15: GetHeader

 /// <summary>
 /// Lookup the license header file within the given projectItems.
 /// </summary>
 /// <param name="projectItems"></param>
 /// <returns>A dictionary, which contains the extensions and the corresponding lines</returns>
 public static IDictionary<string, string[]> GetHeader (ProjectItems projectItems)
 {
   //Check for License-file within this level
   var headerFile = GetLicenseHeaderDefinitions (projectItems);
   if (!string.IsNullOrEmpty (headerFile))
     return LoadLicenseHeaderDefinition (headerFile); //Found a License header file on this level
   return null;
 }
开发者ID:Vault16Software,项目名称:LicenseHeaderManager,代码行数:13,代码来源:LicenseHeaderFinder.cs


注:本文中的ProjectItems类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。