diff --git a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/ClearConsoleCommand.cs b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/ClearConsoleCommand.cs new file mode 100644 index 0000000..7bed555 --- /dev/null +++ b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/ClearConsoleCommand.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands +{ + internal class ClearConsoleCommand : EngineCommand + { + public ClearConsoleCommand() : base("clear") + { + + } + + public override string Help(string argument = null) + { + return "Clears the console."; + } + + public override void Run(string[] arguments = null) + { + Console.Clear(); + } + } +} diff --git a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/HelpCommand.cs b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/HelpCommand.cs similarity index 97% rename from RecrownedAthenaeum.ConsoleTools/CommandProcessor/HelpCommand.cs rename to RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/HelpCommand.cs index 622f6c5..a4c01d6 100644 --- a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/HelpCommand.cs +++ b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/HelpCommand.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace RecrownedAthenaeum.Tools.CommandProcessor +namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands { internal class HelpCommand : EngineCommand { diff --git a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/StopCommand.cs b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/StopCommand.cs similarity index 90% rename from RecrownedAthenaeum.ConsoleTools/CommandProcessor/StopCommand.cs rename to RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/StopCommand.cs index a1c0f71..5e587a0 100644 --- a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/StopCommand.cs +++ b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/StopCommand.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace RecrownedAthenaeum.Tools.CommandProcessor +namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands { internal class StopCommand : EngineCommand { diff --git a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/TestCommand.cs b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/TestCommand.cs similarity index 96% rename from RecrownedAthenaeum.ConsoleTools/CommandProcessor/TestCommand.cs rename to RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/TestCommand.cs index b7421bc..9c9fc9e 100644 --- a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/TestCommand.cs +++ b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/Commands/TestCommand.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace RecrownedAthenaeum.Tools.CommandProcessor +namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands { class TestCommand : EngineCommand { diff --git a/RecrownedAthenaeum.ConsoleTools/RecrownedAthenaeum.Tools.csproj b/RecrownedAthenaeum.ConsoleTools/RecrownedAthenaeum.Tools.csproj index b394c1a..b94566d 100644 --- a/RecrownedAthenaeum.ConsoleTools/RecrownedAthenaeum.Tools.csproj +++ b/RecrownedAthenaeum.ConsoleTools/RecrownedAthenaeum.Tools.csproj @@ -9,6 +9,10 @@ RecrownedAthenaeum.Tools + + true + + diff --git a/RecrownedAthenaeum.ConsoleTools/Tools.cs b/RecrownedAthenaeum.ConsoleTools/Tools.cs index ae68471..9c0700a 100644 --- a/RecrownedAthenaeum.ConsoleTools/Tools.cs +++ b/RecrownedAthenaeum.ConsoleTools/Tools.cs @@ -1,4 +1,5 @@ using RecrownedAthenaeum.Tools.CommandProcessor; +using RecrownedAthenaeum.Tools.CommandProcessor.Commands; using RecrownedAthenaeum.Tools.TextureAtlasTools; using System; using System.Reflection; @@ -18,14 +19,23 @@ namespace RecrownedAthenaeum.Tools ce.commands.Add(new TexturePackerCommand()); ce.commands.Add(new StopCommand(ce)); ce.commands.Add(new TestCommand()); + ce.commands.Add(new ClearConsoleCommand()); - if (args != null) + if (args.Length > 0) { ConsoleUtilities.WriteWrappedLine("Executing as one time use."); StringBuilder sb = new StringBuilder(); for (int i = 0; i < args.Length; i++) sb.Append(args[i] + ' '); - ce.Process(sb.ToString().Trim()); - } else + try + { + ce.Process(sb.ToString().Trim()); + } + catch (ArgumentException e) + { + ConsoleUtilities.WriteWrappedLine("An error has occurred: " + e.Message); + } + } + else { ce.Run(); }