logic: vs plugin solution utility

Utility class to get list of files in a vs solution in the plugin.
This commit is contained in:
Manuel Dobusch
2015-12-30 01:06:15 +01:00
parent 5af8d0f03f
commit 958dad1d59
6 changed files with 155 additions and 5 deletions
@@ -132,6 +132,7 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PkgCmdID.cs" />
<Compile Include="SolutionUtility.cs" />
<Compile Include="SystemUtility.cs" />
</ItemGroup>
<ItemGroup>
@@ -14,6 +14,7 @@ using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading;
using System.Collections.Generic;
using EnvDTE;
using EnvDTE80;
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EnvDTE;
namespace CoatiSoftware.CoatiPlugin
{
class SolutionUtility
{
public static List<String> GetSolutionProjects(DTE dte)
{
List<String> projectNames = new List<String>();
EnvDTE.Solution solution = dte.Solution;
EnvDTE.Projects projects = solution.Projects;
foreach (EnvDTE.Project project in projects)
{
projectNames.Add(project.Name);
}
return projectNames;
}
public static List<List<String>> GetSolutionProjectItems(DTE dte)
{
List<List<String>> projectItems = new List<List<String>>();
EnvDTE.Solution solution = dte.Solution;
EnvDTE.Projects projects = solution.Projects;
foreach (EnvDTE.Project project in projects)
{
EnvDTE.ProjectItems items = project.ProjectItems;
List<String> pItems = new List<String>();
foreach(EnvDTE.ProjectItem item in items)
{
for (short i = 0; i < item.FileCount; i++)
{
pItems.Add(item.get_FileNames(i));
}
}
projectItems.Add(pItems);
}
return projectItems;
}
}
}