From ba83ccfa6e10c3315d6c6d0a1829228c27ec784a Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sat, 2 Aug 2025 18:50:33 +1000 Subject: [PATCH] refactor --- .../VsPersistence/VsPersistenceMapper.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/VsPersistenceMapper.cs b/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/VsPersistenceMapper.cs index 4aa039f..c271073 100644 --- a/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/VsPersistenceMapper.cs +++ b/src/SharpIDE.Application/Features/SolutionDiscovery/VsPersistence/VsPersistenceMapper.cs @@ -22,11 +22,7 @@ public static class VsPersistenceMapper Folders = intermediateModel.SolutionFolders.Select(s => new SharpIdeSolutionFolder { Name = s.Model.Name, - Files = s.Files.Select(x => new SharpIdeFile - { - Path = x.FullPath, - Name = x.Name - }).ToList(), + Files = s.Files.Select(GetSharpIdeFile).ToList(), Folders = s.Folders.Select(GetSharpIdeSolutionFolder).ToList(), Projects = s.Projects.Select(GetSharpIdeProjectModel).ToList() }).ToList(), @@ -48,12 +44,14 @@ public static class VsPersistenceMapper private static SharpIdeSolutionFolder GetSharpIdeSolutionFolder(IntermediateSlnFolderModel folderModel) => new SharpIdeSolutionFolder() { Name = folderModel.Model.Name, - Files = folderModel.Files.Select(x => new SharpIdeFile - { - Path = x.FullPath, - Name = x.Name - }).ToList(), + Files = folderModel.Files.Select(GetSharpIdeFile).ToList(), Folders = folderModel.Folders.Select(GetSharpIdeSolutionFolder).ToList(), Projects = folderModel.Projects.Select(GetSharpIdeProjectModel).ToList() }; + + private static SharpIdeFile GetSharpIdeFile(IntermediateSlnFolderFileModel fileModel) => new SharpIdeFile + { + Path = fileModel.FullPath, + Name = fileModel.Name + }; }