Lua向C#逻辑迁移 一期 #13

将整个插件代码上传
This commit is contained in:
2025-10-26 21:48:39 +08:00
parent 56994b3927
commit 648386cd73
785 changed files with 53683 additions and 2 deletions

View File

@ -0,0 +1,47 @@
namespace UnrealSharpBuildTool.Actions;
public class GenerateSolution : BuildToolAction
{
public override bool RunAction()
{
using BuildToolProcess generateSln = new BuildToolProcess();
// Create a solution.
generateSln.StartInfo.ArgumentList.Add("new");
generateSln.StartInfo.ArgumentList.Add("sln");
// Assign project name to the solution.
generateSln.StartInfo.ArgumentList.Add("-n");
generateSln.StartInfo.ArgumentList.Add(Program.GetProjectNameAsManaged());
generateSln.StartInfo.WorkingDirectory = Program.GetScriptFolder();
// Force the creation of the solution.
generateSln.StartInfo.ArgumentList.Add("--force");
generateSln.StartBuildToolProcess();
List<string> existingProjectsList = GetExistingProjects()
.Select(x => Path.GetRelativePath(Program.GetScriptFolder(), x))
.ToList();
GenerateProject.AddProjectToSln(existingProjectsList);
return true;
}
private static IEnumerable<string> GetExistingProjects()
{
var scriptsDirectory = new DirectoryInfo(Program.GetScriptFolder());
var pluginsDirectory = new DirectoryInfo(Program.GetPluginsFolder());
return FindCSharpProjects(scriptsDirectory)
.Concat(pluginsDirectory.EnumerateFiles("*.uplugin", SearchOption.AllDirectories)
.Select(x => x.Directory)
.SelectMany(x => x!.EnumerateDirectories("Script"))
.SelectMany(FindCSharpProjects))
.Select(x => x.FullName);
}
private static IEnumerable<FileInfo> FindCSharpProjects(DirectoryInfo directoryInfo)
{
IEnumerable<FileInfo> files = directoryInfo.EnumerateFiles("*.csproj", SearchOption.AllDirectories);
return files;
}
}