using RecrownedGTK.Tools.CommandProcessor; using RecrownedGTK.Tools.CommandProcessor.Commands; using RecrownedGTK.Tools.NinePatchTools; using RecrownedGTK.Tools.TextureAtlasTools; using System; using System.Reflection; using System.Text; namespace RecrownedGTK.Tools { internal class Program { private class ConsoleInput : IUserInput { public string GetInput() { return Console.ReadLine(); } } static void Main(string[] args) { CommandEngine ce = new CommandEngine(); ConsoleUtilities.WriteWrappedLine("Recrowned Athenaeum Console Tools version " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); ConsoleUtilities.WriteWrappedLine("Type \"help\" for help."); ce.commands.Add(new HelpCommand(ce)); ce.commands.Add(new TexturePackerCommand()); ce.commands.Add(new StopCommand(ce)); ce.commands.Add(new ClearConsoleCommand()); ce.commands.Add(new NinePatchCommand()); 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] + ' '); string commandAndArgs = sb.ToString().TrimEnd(); try { ConsoleUtilities.WriteWrappedLine("Command and argument received: " + commandAndArgs); ce.Process(commandAndArgs); } catch (ArgumentException e) { ConsoleUtilities.WriteWrappedLine("An error has occurred: " + e.Message); } } else { ce.Run(new ConsoleInput()); } } } }