Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
#246 Solution analysis missing project in folders (#247)
Browse files Browse the repository at this point in the history
* #246 Solution analysis missing project in folders

* #246 Solution analysis missing project in folders

Co-authored-by: Vadim Starodubov <vadim.starodubov@railsreactor.com>
  • Loading branch information
ElRato and Vadim Starodubov authored Sep 7, 2021
1 parent dd74271 commit 35d49fc
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Source/MDKServices/HealthAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,33 @@ public class HealthAnalysis
/// <param name="solution"></param>
/// <param name="options"></param>
/// <returns></returns>
public static Task<HealthAnalysis[]> AnalyzeAsync(Solution solution, HealthAnalysisOptions options) => System.Threading.Tasks.Task.WhenAll(solution.Projects.Cast<Project>().Select(project => System.Threading.Tasks.Task.Run(() => Analyze(project, options))));
public static Task<HealthAnalysis[]> AnalyzeAsync(Solution solution, HealthAnalysisOptions options) {
var projectTaks = GetProjects(solution.Projects.Cast<Project>()).Select(project => System.Threading.Tasks.Task.Run(() => Analyze(project, options)));
return System.Threading.Tasks.Task.WhenAll(projectTaks);
}

private const string C_SHARP_PROJECT_KIND = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";

private static IEnumerable<Project> GetProjects(IEnumerable<Project> projects) {
var result = new List<Project>();
foreach (var project in projects) {
if (new Guid(project.Kind) == new Guid(C_SHARP_PROJECT_KIND))
result.Add(project);
else if (project.ProjectItems != null)
{
result.AddRange(GetProjects(project.ProjectItems.Cast<ProjectItem>().Select(x => x.SubProject).OfType<Project>()));
}
}
return result;
}

// ReSharper disable once InconsistentNaming
private const int RPC_E_SERVERCALL_RETRYLATER = unchecked((int)0x8001010A);


static HealthAnalysis Analyze(Project project, HealthAnalysisOptions options)
{
options.Echo?.Invoke("Analyzing project...");
options.Echo?.Invoke($"{project.Name}: Analyzing project...");
while (true)
{
try
Expand Down

0 comments on commit 35d49fc

Please sign in to comment.