示例#1
0
 public static ProjectItem FindItemByName(ProjectItems collection, string name, bool recursive)
 {
     if (collection != null)
     {
         foreach (ProjectItem projectItem in collection)
         {
             if (projectItem.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
             {
                 ProjectItem result = projectItem;
                 return(result);
             }
             if (recursive)
             {
                 ProjectItem projectItem2 = DteService.FindItemByName(projectItem.ProjectItems, name, recursive);
                 if (projectItem2 != null)
                 {
                     ProjectItem result = projectItem2;
                     return(result);
                 }
             }
         }
     }
     return(null);
 }
示例#2
0
 public static void CreateNewTextFile(string title, string fileContents)
 {
     DteService.CreateNewFile("General\\Text File", title, fileContents);
 }