Example #1
0
        public HelpCommand(CommandHandler handler, TextWriter output)
            : base("help", output)
        {
            AddSwitch(new CommandSwitch("-command", CommandSwitch.ValueMode.ExpectSingle, true));

            this.handler = handler;
        }
Example #2
0
        private static void RunCommandProcessingLoop( TextReader input, TextWriter output )
        {
            CommandHandler commandHandler = new CommandHandler();

            InitCommands( commandHandler, output);

            while ( true )
            {
                output.Write( "> " );
                string command = input.ReadLine();

                try
                {
                    commandHandler.ProcessCommandLine( command );
                }
                catch ( Exception e )
                {
                    output.WriteLine(
                        string.Format(
                            "Error: {0}\n{1}\n",
                            e.Message,
                            ( e.InnerException != null ) ? e.InnerException.Message : ""
                        )
                    );
                }
            }
        }
Example #3
0
        private static void InitCommands(
            CommandHandler handler, 
            TextWriter output
        )
        {
            handler.RegisterCommand(new HelpCommand( handler, output ) );
            handler.RegisterCommand(new QuitCommand( output ) );

            //order - 16
            handler.RegisterCommand(new AddOrderCommand(output));
            handler.RegisterCommand(new AddFoundsCommand(output));
            handler.RegisterCommand(new ShowOrderCommand(output));
            handler.RegisterCommand(new ChangeCustomerName(output));
            handler.RegisterCommand(new UpdateStatusCommand(output));
            handler.RegisterCommand(new ShowAllOrdersCommand(output));
            handler.RegisterCommand(new ChangeCommentCommand(output));
            handler.RegisterCommand(new ChangeEventTypeCommand(output));
            handler.RegisterCommand(new UpdateEventCostCommand(output));
            handler.RegisterCommand(new ShowAttacheScriptIDCommand(output));
            handler.RegisterCommand(new ChangeCustomerEmailCommand(output));
            handler.RegisterCommand(new AttachScriptIDtoOrderCommand(output));
            handler.RegisterCommand(new ChangeCustomerPhoneNumberCommand(output));
            handler.RegisterCommand(new ShowOrderWithSimilarEventsCommand(output));
            handler.RegisterCommand(new ShowOrdersWithSimilarStatusCommand(output));
            handler.RegisterCommand(new ShowOrdersWithSimilarCustomerNameCommand(output));

            //images - 9
            handler.RegisterCommand(new AddImageCommand(output));
            handler.RegisterCommand(new ShowAllImagesCommand(output));
            handler.RegisterCommand(new ChangeImageURLCommand(output));
            handler.RegisterCommand(new SearchImagebyIdCommand(output));
            handler.RegisterCommand(new ChangeImageNameCommand(output));
            handler.RegisterCommand(new ChangeImageEventTypeCommand(output));
            handler.RegisterCommand(new ChangeImageDescriptionCommand(output));
            handler.RegisterCommand(new ShowImagesWithSimilarNameCommand(output));
            handler.RegisterCommand(new ShowImagesWithSimilarEventTypeCommand(output));

            //script - 9
            handler.RegisterCommand(new AddNewScriptCommand(output));
            handler.RegisterCommand(new ShowAllScriptsCommand(output));
            handler.RegisterCommand(new ShowScriptbyIdCommand(output));
            handler.RegisterCommand(new ChangeScriptDurCommand(output));
            handler.RegisterCommand(new ChangeScriptBodyCommand(output));
            handler.RegisterCommand(new ChangeScriptTypeCommand(output));
            handler.RegisterCommand(new ChangeScriptNameCommand(output));
            handler.RegisterCommand(new SearchScriptsWithSimilarTypeCommand(output));
            handler.RegisterCommand(new SearchScriptsWithSimilarNameCommand(output));
        }