From cdf50d07b5ff9dc283e3921104cfd7e4bdd242cb Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Mon, 3 Nov 2025 01:26:38 +1000 Subject: [PATCH] add interface --- .../VsPersistence/SharpIdeModels.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/SharpIdeModels.cs b/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/SharpIdeModels.cs index 285d988..ab113b2 100644 --- a/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/SharpIdeModels.cs +++ b/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/SharpIdeModels.cs @@ -14,7 +14,10 @@ public interface IExpandableSharpIdeNode { public bool Expanded { get; set; } } - +public interface ISolutionOrProject +{ + public string DirectoryPath { get; set; } +} public interface IFolderOrProject : IExpandableSharpIdeNode, IChildSharpIdeNode { public ObservableList Folders { get; init; } @@ -43,7 +46,7 @@ public interface IChildSharpIdeNode } } -public class SharpIdeSolutionModel : ISharpIdeNode, IExpandableSharpIdeNode +public class SharpIdeSolutionModel : ISharpIdeNode, IExpandableSharpIdeNode, ISolutionOrProject { public required string Name { get; set; } public required string FilePath { get; set; } @@ -91,11 +94,12 @@ public class SharpIdeSolutionFolder : ISharpIdeNode, IExpandableSharpIdeNode, IC Projects = new ObservableHashSet(intermediateModel.Projects.Select(x => new SharpIdeProjectModel(x, allProjects, allFiles, allFolders, this))); } } -public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChildSharpIdeNode, IFolderOrProject +public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChildSharpIdeNode, IFolderOrProject, ISolutionOrProject { public required string Name { get; set; } public required string FilePath { get; set; } - public string ChildNodeBasePath => Path.GetDirectoryName(FilePath)!; + public required string DirectoryPath { get; set; } + public string ChildNodeBasePath => DirectoryPath; public required ObservableList Folders { get; init; } public required ObservableList Files { get; init; } public bool Expanded { get; set; } @@ -110,6 +114,7 @@ public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChi Parent = parent; Name = projectModel.Model.ActualDisplayName; FilePath = projectModel.FullFilePath; + DirectoryPath = Path.GetDirectoryName(projectModel.FullFilePath)!; Files = new ObservableList(TreeMapperV2.GetFiles(projectModel.FullFilePath, this, allFiles)); Folders = new ObservableList(TreeMapperV2.GetSubFolders(projectModel.FullFilePath, this, allFiles, allFolders)); MsBuildEvaluationProjectTask = ProjectEvaluation.GetProject(projectModel.FullFilePath);