refactoring and added clear command.
This commit is contained in:
parent
8de9d86370
commit
af7653dbdd
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RecrownedAthenaeum.Tools.CommandProcessor
|
||||
namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands
|
||||
{
|
||||
internal class HelpCommand : EngineCommand
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RecrownedAthenaeum.Tools.CommandProcessor
|
||||
namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands
|
||||
{
|
||||
internal class StopCommand : EngineCommand
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RecrownedAthenaeum.Tools.CommandProcessor
|
||||
namespace RecrownedAthenaeum.Tools.CommandProcessor.Commands
|
||||
{
|
||||
class TestCommand : EngineCommand
|
||||
{
|
@ -9,6 +9,10 @@
|
||||
<RootNamespace>RecrownedAthenaeum.Tools</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0005" />
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user