41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
|
using CliFx;
|
|||
|
using CliFx.Attributes;
|
|||
|
using CliFx.Infrastructure;
|
|||
|
using ReCodeIt.CrossCompiler;
|
|||
|
using ReCodeItLib.Utils;
|
|||
|
|
|||
|
namespace ReCodeIt.Commands;
|
|||
|
|
|||
|
[Command("Build", Description = "Build your project and get a dll output for the original assembly. You dont need to provide a path if the last project you built is the one you want to target")]
|
|||
|
public class BuildCommand : ICommand
|
|||
|
{
|
|||
|
private ReCodeItCrossCompiler CrossCompiler { get; set; }
|
|||
|
|
|||
|
[CommandParameter(0, IsRequired = false, Description = "the location of your project file")]
|
|||
|
public string ProjectJsonPath { get; init; }
|
|||
|
|
|||
|
public ValueTask ExecuteAsync(IConsole console)
|
|||
|
{
|
|||
|
if (ProjectJsonPath is not null && ProjectJsonPath != string.Empty)
|
|||
|
{
|
|||
|
CrossCompiler = new();
|
|||
|
ProjectManager.LoadProject(ProjectJsonPath);
|
|||
|
CrossCompiler.StartCrossCompile();
|
|||
|
|
|||
|
return default;
|
|||
|
}
|
|||
|
|
|||
|
console.Output.WriteLine(RegistryHelper.GetRegistryValue<string>("LastLoadedProject"));
|
|||
|
|
|||
|
if (RegistryHelper.GetRegistryValue<string>("LastLoadedProject") != null)
|
|||
|
{
|
|||
|
CrossCompiler = new();
|
|||
|
ProjectManager.LoadProject(RegistryHelper.GetRegistryValue<string>("LastLoadedProject"), true);
|
|||
|
CrossCompiler.StartCrossCompile();
|
|||
|
|
|||
|
return default;
|
|||
|
}
|
|||
|
|
|||
|
return default;
|
|||
|
}
|
|||
|
}
|