change file to execution stop point
This commit is contained in:
@@ -10,10 +10,11 @@ public class SharpIdeFile : ISharpIdeNode, IChildSharpIdeNode
|
||||
public required string Name { get; set; }
|
||||
|
||||
[SetsRequiredMembers]
|
||||
internal SharpIdeFile(string fullPath, string name, IExpandableSharpIdeNode parent)
|
||||
internal SharpIdeFile(string fullPath, string name, IExpandableSharpIdeNode parent, HashSet<SharpIdeFile> allFiles)
|
||||
{
|
||||
Path = fullPath;
|
||||
Name = name;
|
||||
Parent = parent;
|
||||
allFiles.Add(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ public class SharpIdeFolder : ISharpIdeNode, IExpandableSharpIdeNode, IChildShar
|
||||
public bool Expanded { get; set; }
|
||||
|
||||
[SetsRequiredMembers]
|
||||
public SharpIdeFolder(DirectoryInfo folderInfo, IExpandableSharpIdeNode parent)
|
||||
public SharpIdeFolder(DirectoryInfo folderInfo, IExpandableSharpIdeNode parent, HashSet<SharpIdeFile> allFiles)
|
||||
{
|
||||
Parent = parent;
|
||||
Path = folderInfo.FullName;
|
||||
Name = folderInfo.Name;
|
||||
Files = folderInfo.GetFiles(this);
|
||||
Folders = this.GetSubFolders(this);
|
||||
Files = folderInfo.GetFiles(this, allFiles);
|
||||
Folders = this.GetSubFolders(this, allFiles);
|
||||
}
|
||||
|
||||
public SharpIdeFolder()
|
||||
|
||||
@@ -10,7 +10,7 @@ public static class TreeMapperV2
|
||||
return folder.Files
|
||||
.Concat(folder.Folders.SelectMany(sub => sub.GetAllFiles()));
|
||||
}
|
||||
public static List<SharpIdeFolder> GetSubFolders(string csprojectPath, SharpIdeProjectModel sharpIdeProjectModel)
|
||||
public static List<SharpIdeFolder> GetSubFolders(string csprojectPath, SharpIdeProjectModel sharpIdeProjectModel, HashSet<SharpIdeFile> allFiles)
|
||||
{
|
||||
var projectDirectory = Path.GetDirectoryName(csprojectPath)!;
|
||||
var rootFolder = new SharpIdeFolder
|
||||
@@ -21,12 +21,12 @@ public static class TreeMapperV2
|
||||
Files = [],
|
||||
Folders = []
|
||||
};
|
||||
var subFolders = rootFolder.GetSubFolders(sharpIdeProjectModel);
|
||||
var subFolders = rootFolder.GetSubFolders(sharpIdeProjectModel, allFiles);
|
||||
return subFolders;
|
||||
}
|
||||
|
||||
private static readonly string[] _excludedFolders = ["bin", "obj", "node_modules"];
|
||||
public static List<SharpIdeFolder> GetSubFolders(this SharpIdeFolder folder, IExpandableSharpIdeNode parent)
|
||||
public static List<SharpIdeFolder> GetSubFolders(this SharpIdeFolder folder, IExpandableSharpIdeNode parent, HashSet<SharpIdeFile> allFiles)
|
||||
{
|
||||
var directoryInfo = new DirectoryInfo(folder.Path);
|
||||
ConcurrentBag<SharpIdeFolder> subFolders = [];
|
||||
@@ -47,20 +47,20 @@ public static class TreeMapperV2
|
||||
|
||||
Parallel.ForEach(subFolderInfos, subFolderInfo =>
|
||||
{
|
||||
var subFolder = new SharpIdeFolder(subFolderInfo, parent);
|
||||
var subFolder = new SharpIdeFolder(subFolderInfo, parent, allFiles);
|
||||
subFolders.Add(subFolder);
|
||||
});
|
||||
|
||||
return subFolders.ToList();
|
||||
}
|
||||
|
||||
public static List<SharpIdeFile> GetFiles(string csprojectPath, SharpIdeProjectModel sharpIdeProjectModel)
|
||||
public static List<SharpIdeFile> GetFiles(string csprojectPath, SharpIdeProjectModel sharpIdeProjectModel, HashSet<SharpIdeFile> allFiles)
|
||||
{
|
||||
var projectDirectory = Path.GetDirectoryName(csprojectPath)!;
|
||||
var directoryInfo = new DirectoryInfo(projectDirectory);
|
||||
return GetFiles(directoryInfo, sharpIdeProjectModel);
|
||||
return GetFiles(directoryInfo, sharpIdeProjectModel, allFiles);
|
||||
}
|
||||
public static List<SharpIdeFile> GetFiles(this DirectoryInfo directoryInfo, IExpandableSharpIdeNode parent)
|
||||
public static List<SharpIdeFile> GetFiles(this DirectoryInfo directoryInfo, IExpandableSharpIdeNode parent, HashSet<SharpIdeFile> allFiles)
|
||||
{
|
||||
List<FileInfo> fileInfos;
|
||||
try
|
||||
@@ -72,7 +72,7 @@ public static class TreeMapperV2
|
||||
return [];
|
||||
}
|
||||
|
||||
return fileInfos.Select(f => new SharpIdeFile(f.FullName, f.Name, parent)
|
||||
return fileInfos.Select(f => new SharpIdeFile(f.FullName, f.Name, parent, allFiles)
|
||||
{
|
||||
Path = f.FullName,
|
||||
Name = f.Name,
|
||||
|
||||
@@ -34,6 +34,7 @@ public class SharpIdeSolutionModel : ISharpIdeNode, IExpandableSharpIdeNode
|
||||
public required List<SharpIdeProjectModel> Projects { get; set; }
|
||||
public required List<SharpIdeSolutionFolder> Folders { get; set; }
|
||||
public required HashSet<SharpIdeProjectModel> AllProjects { get; set; }
|
||||
public required HashSet<SharpIdeFile> AllFiles { get; set; }
|
||||
public bool Expanded { get; set; }
|
||||
|
||||
[SetsRequiredMembers]
|
||||
@@ -41,10 +42,11 @@ public class SharpIdeSolutionModel : ISharpIdeNode, IExpandableSharpIdeNode
|
||||
{
|
||||
var solutionName = Path.GetFileName(solutionFilePath);
|
||||
AllProjects = [];
|
||||
AllFiles = [];
|
||||
Name = solutionName;
|
||||
FilePath = solutionFilePath;
|
||||
Projects = intermediateModel.Projects.Select(s => new SharpIdeProjectModel(s, AllProjects, this)).ToList();
|
||||
Folders = intermediateModel.SolutionFolders.Select(s => new SharpIdeSolutionFolder(s, AllProjects, this)).ToList();
|
||||
Projects = intermediateModel.Projects.Select(s => new SharpIdeProjectModel(s, AllProjects, AllFiles, this)).ToList();
|
||||
Folders = intermediateModel.SolutionFolders.Select(s => new SharpIdeSolutionFolder(s, AllProjects, AllFiles, this)).ToList();
|
||||
}
|
||||
}
|
||||
public class SharpIdeSolutionFolder : ISharpIdeNode, IExpandableSharpIdeNode, IChildSharpIdeNode
|
||||
@@ -57,13 +59,13 @@ public class SharpIdeSolutionFolder : ISharpIdeNode, IExpandableSharpIdeNode, IC
|
||||
public required IExpandableSharpIdeNode Parent { get; set; }
|
||||
|
||||
[SetsRequiredMembers]
|
||||
internal SharpIdeSolutionFolder(IntermediateSlnFolderModel intermediateModel, HashSet<SharpIdeProjectModel> allProjects, IExpandableSharpIdeNode parent)
|
||||
internal SharpIdeSolutionFolder(IntermediateSlnFolderModel intermediateModel, HashSet<SharpIdeProjectModel> allProjects, HashSet<SharpIdeFile> allFiles, IExpandableSharpIdeNode parent)
|
||||
{
|
||||
Name = intermediateModel.Model.Name;
|
||||
Parent = parent;
|
||||
Files = intermediateModel.Files.Select(s => new SharpIdeFile(s.FullPath, s.Name, this)).ToList();
|
||||
Folders = intermediateModel.Folders.Select(x => new SharpIdeSolutionFolder(x, allProjects, this)).ToList();
|
||||
Projects = intermediateModel.Projects.Select(x => new SharpIdeProjectModel(x, allProjects, this)).ToList();
|
||||
Files = intermediateModel.Files.Select(s => new SharpIdeFile(s.FullPath, s.Name, this, allFiles)).ToList();
|
||||
Folders = intermediateModel.Folders.Select(x => new SharpIdeSolutionFolder(x, allProjects, allFiles, this)).ToList();
|
||||
Projects = intermediateModel.Projects.Select(x => new SharpIdeProjectModel(x, allProjects, allFiles, this)).ToList();
|
||||
}
|
||||
}
|
||||
public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChildSharpIdeNode
|
||||
@@ -79,13 +81,13 @@ public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChi
|
||||
public required Task<Project> MsBuildEvaluationProjectTask { get; set; }
|
||||
|
||||
[SetsRequiredMembers]
|
||||
internal SharpIdeProjectModel(IntermediateProjectModel projectModel, HashSet<SharpIdeProjectModel> allProjects, IExpandableSharpIdeNode parent)
|
||||
internal SharpIdeProjectModel(IntermediateProjectModel projectModel, HashSet<SharpIdeProjectModel> allProjects, HashSet<SharpIdeFile> allFiles, IExpandableSharpIdeNode parent)
|
||||
{
|
||||
Parent = parent;
|
||||
Name = projectModel.Model.ActualDisplayName;
|
||||
FilePath = projectModel.FullFilePath;
|
||||
Files = TreeMapperV2.GetFiles(projectModel.FullFilePath, this);
|
||||
Folders = TreeMapperV2.GetSubFolders(projectModel.FullFilePath, this);
|
||||
Files = TreeMapperV2.GetFiles(projectModel.FullFilePath, this, allFiles);
|
||||
Folders = TreeMapperV2.GetSubFolders(projectModel.FullFilePath, this, allFiles);
|
||||
MsBuildEvaluationProjectTask = ProjectEvaluation.GetProject(projectModel.FullFilePath);
|
||||
allProjects.Add(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user