diff --git a/ReCodeItCLI/Commands/Build.cs b/ReCodeItCLI/Commands/Build.cs deleted file mode 100644 index e60d2a8..0000000 --- a/ReCodeItCLI/Commands/Build.cs +++ /dev/null @@ -1,100 +0,0 @@ -using CliFx; -using CliFx.Attributes; -using CliFx.Infrastructure; -using ReCodeIt.CrossCompiler; -using ReCodeIt.Utils; - -namespace ReCodeIt.Commands; - -[Command("Build", Description = "(Compile Time Reflection) Build your project and get a dll output for the original assembly.")] -public class Build : ICommand -{ - private ReCodeItCrossCompiler CrossCompiler { get; set; } - - [CommandParameter(0, IsRequired = false, Description = "the location of your project file (ReCodeItProj.json). You don't need to provide a path if the last project you built is the one you want to target, or you are running this command from inside a directory where a project file exists.")] - public string ProjectJsonPath { get; init; } - - public async ValueTask ExecuteAsync(IConsole console) - { - var isLocal = await UseLocalProject(console); - - if (isLocal) { return; } - - var isRemote = await UseRemoteProject(console); - - if (isRemote) { return; } - - // Wait for log termination - Logger.Terminate(); - while(Logger.IsRunning()) {} - } - - private async Task UseLocalProject(IConsole console) - { - var jsonPath = Path.Combine(Directory.GetCurrentDirectory(), "ReCodeItProj.json"); - - if (File.Exists(jsonPath)) - { - Logger.Log("Found a project file in the current directory, loading it", ConsoleColor.Yellow); - - CrossCompiler = new(); - - DataProvider.LoadAppSettings(); - DataProvider.IsCli = true; - - ProjectManager.LoadProject(jsonPath); - await CrossCompiler.StartCrossCompile(); - - return true; - } - - return false; - } - - private async Task UseRemoteProject(IConsole console) - { - if (ProjectJsonPath is not null && ProjectJsonPath != string.Empty) - { - if (!File.Exists(ProjectJsonPath)) - { - console.Output.WriteLine("The project file you provided does not exist"); - return false; - } - - CrossCompiler = new(); - - DataProvider.LoadAppSettings(); - DataProvider.IsCli = true; - - ProjectManager.LoadProject(ProjectJsonPath); - await CrossCompiler.StartCrossCompile(); - - return true; - } - - return false; - } - - private bool Validate(IConsole console) - { - if (ProjectManager.ActiveProject == null) - { - console.Output.WriteLine("No project loaded, go create or load a project in the gui first"); - return false; - } - - if (ProjectManager.ActiveProject.RemapModels.Count == 0) - { - console.Output.WriteLine("No Remaps present, go to the gui and create some first"); - return false; - } - - if (ProjectManager.ActiveProject.ChangedTypes.Count == 0) - { - console.Output.WriteLine("There are no changed types, have you created and used a remapped reference? \nRun the command `buildRef` to generate a project reference"); - return false; - } - - return true; - } -} \ No newline at end of file diff --git a/ReCodeItCLI/Commands/BuildRef.cs b/ReCodeItCLI/Commands/BuildRef.cs deleted file mode 100644 index b6b1d26..0000000 --- a/ReCodeItCLI/Commands/BuildRef.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CliFx; -using CliFx.Attributes; -using CliFx.Infrastructure; -using ReCodeIt.CrossCompiler; -using ReCodeIt.Utils; - -namespace ReCodeIt.Commands; - -[Command("BuildRef", Description = "(Compile Time Reflection) Builds or rebuilds a new reference DLL for your project")] -public class BuildRef : ICommand -{ - private ReCodeItCrossCompiler CrossCompiler { get; set; } - - public ValueTask ExecuteAsync(IConsole console) - { - if (DataProvider.Settings.CrossCompiler.LastLoadedProject != null) - { - CrossCompiler = new(); - - DataProvider.LoadAppSettings(); - DataProvider.IsCli = true; - - ProjectManager.LoadProject(DataProvider.Settings.CrossCompiler.LastLoadedProject); - - if (!Validate(console)) { return default; } - - CrossCompiler.StartRemap(); - - DataProvider.SaveAppSettings(); - } - - // Wait for log termination - Logger.Terminate(); - while(Logger.IsRunning()) {} - - return default; - } - - private bool Validate(IConsole console) - { - if (ProjectManager.ActiveProject == null) - { - console.Output.WriteLine("No project loaded, please load a project first"); - return false; - } - - if (ProjectManager.ActiveProject.RemapModels.Count == 0) - { - console.Output.WriteLine("No Remaps present, go to the gui and create some first"); - return false; - } - - return true; - } -} \ No newline at end of file