public ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine("");
            help.AppendLine(ConsoleFormatting.FixedLength("CreateQueue queueName", "Creates the queue in the transport"));
            help.AppendLine(ConsoleFormatting.FixedLength("RemoveQueue queueName", "Removes the queue from the transport"));

            help.AppendLine("Queue options (set before CreateQueue)");
            help.AppendLine("");

            help.AppendLine(ConsoleFormatting.FixedLength("SetQueueType queueName", "Type of the queue; needed for Rpc. 1=NotRpc,2=sendRpc,3=receiveRpc"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetDelayedProcessing queueName", "Enables/Disables delayed processing"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetHeartBeat queueName", "Enables/Disables heart beat support"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetMessageExpiration queueName", "Enables/Disables message expiration"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetPriority queueName", "Enables/Disables message priority"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetStatus queueName", "Enables/Disables using a status column to flag pending/working items"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetStatusTable queueName", "Enables/Disables a separate status tracking table for external code to query"));
            help.AppendLine("");
            help.AppendLine(ConsoleFormatting.FixedLength("AddColumn queueName", "Adds a new user column to the status table"));
            help.AppendLine(ConsoleFormatting.FixedLength("AddColumnWithLength queueName", "Adds a new user column to the status table"));
            help.AppendLine(ConsoleFormatting.FixedLength("AddColumnWithPrecision queueName", "Adds a new user column to the status table"));
            help.AppendLine(ConsoleFormatting.FixedLength("AddConstraint queueName", "Adds a new user constraint to the status table"));
            help.AppendLine(ConsoleFormatting.FixedLength("AddConstraintManyColumns queueName", "Adds a new user constraint to the status table"));
            help.AppendLine("");
            return(new ConsoleExecuteResult(help.ToString()));
        }
Exemple #2
0
        static void Run()
        {
            string indent = ConsoleFormatting.Indent();

            while (true)
            {
                var consoleInput = ReadFromConsole();
                if (string.IsNullOrWhiteSpace(consoleInput))
                {
                    continue;
                }

                try
                {
                    Store store = new Store();
                    store.GetAvailableProducts();
                    store.GetSalesOrder();
                    store.CheckOut();

                    string result = CF.ThankYouBanner;

                    WriteToConsole(result);
                }
                catch (Exception ex)
                {
                    WriteToConsole(ex.Message);
                }
            }
        }
        public override ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine(base.Help().Message);

            help.AppendLine(ConsoleFormatting.FixedLength("SetTaskSchedulerConfiguration",
                                                          "Task scheduler configuration options"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetWorkerConfiguration queueName",
                                                          "Worker configuration options"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetHeartBeatConfiguration queueName",
                                                          "HeartBeat configuration options"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetMessageExpirationConfiguration queueName",
                                                          "Message Expiration configuration options"));

            help.AppendLine(ConsoleFormatting.FixedLength("SetFatalExceptionDelayBehavior queueName",
                                                          "Back off times for when fatal errors occur"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetQueueDelayBehavior queueName",
                                                          "Back off times for when the queue is empty"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetQueueRetryBehavior queueName",
                                                          "Retry strategy, based on the type of the exception"));

            help.AppendLine(ConsoleFormatting.FixedLength("CreateQueue queueName queueType",
                                                          "Creates the initial queue in memory. 0=POCO, 1=Linq Expression"));
            help.AppendLine(ConsoleFormatting.FixedLength("StartQueue queueName", "Starts a queue"));
            help.AppendLine(ConsoleFormatting.FixedLength("StopQueue queueName",
                                                          "Stops a queue; configuration will be reset"));
            return(new ConsoleExecuteResult(help.ToString()));
        }
        public ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine(ConsoleFormatting.FixedLength("RemoveQueue queueName", "Removes the queue from the transport"));
            return(new ConsoleExecuteResult(help.ToString()));
        }
        public override ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine(base.Help().Message);
            help.AppendLine(ConsoleFormatting.FixedLength("CreateQueue queueName queueType",
                                                          "Creates the initial queue in memory. 0=POCO, 1=Linq Expression"));
            help.AppendLine(ConsoleFormatting.FixedLength("EnableSerilog",
                                                          "Uses serilog for logging to console; note that this example only works when the worker library is compiled in release mode; this is an example limitation, not a library limitation"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetWorkerConfiguration queueName",
                                                          "Worker configuration options"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetHeartBeatConfiguration queueName",
                                                          "HeartBeat configuration options"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetMessageExpirationConfiguration queueName",
                                                          "Message Expiration configuration options"));

            help.AppendLine(ConsoleFormatting.FixedLength("SetFatalExceptionDelayBehavior queueName",
                                                          "Back off times for when fatal errors occur"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetQueueDelayBehavior queueName",
                                                          "Back off times for when the queue is empty"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetQueueRetryBehavior queueName",
                                                          "Retry strategy, based on the type of the exception"));

            help.AppendLine(ConsoleFormatting.FixedLength("StartQueue queueName", "Starts a queue"));
            help.AppendLine(ConsoleFormatting.FixedLength("StopQueue queueName",
                                                          "Stops a queue; configuration will be reset"));
            return(new ConsoleExecuteResult(help.ToString()));
        }
        public override ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.Append(base.Help().Message);
            help.AppendLine(ConsoleFormatting.FixedLength("Send queueName", "Sends messages"));
            help.AppendLine(ConsoleFormatting.FixedLength("SendAsync queueName", "Sends messages async"));
            return(new ConsoleExecuteResult(help.ToString()));
        }
        public static string Get()
        {
            var sb = new StringBuilder();

            foreach (var user in SampleData.Users)
            {
                sb.AppendLine(ConsoleFormatting.Indent(2) + string.Format("Id:{0} {1} {2}", user.Id, user.FirstName, user.LastName));
            }
            return(sb.ToString());
        }
Exemple #8
0
        public static string Get()
        {
            var sb = new StringBuilder();

            foreach (var user in SampleData.Users)
            {
                sb.Append(ConsoleFormatting.Indent(2)).AppendFormat($"Id:{user.Id} {user.FirstName} {user.LastName}").AppendLine();
            }

            return(sb.ToString());
        }
Exemple #9
0
        public override ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine(base.Help().Message);
            help.AppendLine(ConsoleFormatting.FixedLength("SetRedisOptions queueName", "Sets redis transport specific options"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetTimeClientOptions queueName", "Options for obtaining the current time. 0=localmachine,1=redisServer,2=NTP"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetMessageIdOptions queueName", "Message ID generation. 0=redis,1=uuid"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetSntpTimeConfiguration queueName", "Options for the NTP client"));
            return(new ConsoleExecuteResult(help.ToString()));
        }
Exemple #10
0
        public static string DoSomethingOptional(int id, string data = "No Data Provided")
        {
            var result = string.Format(ConsoleFormatting.Indent(2) +
                                       "I did something to the record Id {0} and saved the data {1}", id, data);

            if (data == "No Data Provided")
            {
                result = string.Format(ConsoleFormatting.Indent(2) +
                                       "I did something to the record Id {0} but the optinal parameter "
                                       + "was not provided, so I saved the value '{1}'", id, data);
            }
            return(result);
        }
Exemple #11
0
        /// <summary>
        /// Gets a list of available products so user is aware of choices
        /// </summary>
        /// <returns>list of available products</returns>
        public static string Get()
        {
            string indent = ConsoleFormatting.Indent();
            var    sb     = new StringBuilder();

            foreach (var product in ap.AvailableProducts)
            {
                sb.AppendLine($"{indent}Product Name: {product.ProductName}, Product Price: {product.ProductPrice:C}");
            }

            Console.WriteLine($"{indent}Your Available Products\n");
            return(sb.ToString());
        }
        public virtual ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine("");
            help.AppendLine("-The following should be enabled before performing queue actions; usage is optional-");
            help.AppendLine(ConsoleFormatting.FixedLength("EnableStatus uri", "Enables the status HTTP server"));
            help.AppendLine(ConsoleFormatting.FixedLength("EnableMetrics uri [performanceCounters]",
                                                          "Enables queue metrics"));
            help.AppendLine(ConsoleFormatting.FixedLength("EnableGzip", "Enables the Gzip message interceptor"));
            help.AppendLine(ConsoleFormatting.FixedLength("EnableDes [key] [iv]",
                                                          "Enables Triple DES message interceptor; key/iv must be base64 strings"));
            help.AppendLine("");
            return(new ConsoleExecuteResult(help.ToString()));
        }
        public ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine("Default commands are");
            help.AppendLine("");
            help.AppendLine(ConsoleFormatting.FixedLength("Help", "Displays command list"));
            help.AppendLine(ConsoleFormatting.FixedLength("Example name", "Displays example syntax for a command"));
            help.AppendLine(ConsoleFormatting.FixedLength("StartMacro", "Starts capturing a new macro"));
            help.AppendLine(ConsoleFormatting.FixedLength("CancelMacro", "Cancels capture of a macro started with 'StartMacro'"));
            help.AppendLine(ConsoleFormatting.FixedLength("SaveMacro Name", "Saves a macro started with 'StartMacro' to the indicated file"));
            help.AppendLine(ConsoleFormatting.FixedLength("RunMacro Name", "Runs the macro"));
            help.AppendLine(ConsoleFormatting.FixedLength("Quit", "Exits the application"));
            help.AppendLine("");
            help.AppendLine("To get help for other name spaces, use <namespace>.Help");
            return(new ConsoleExecuteResult(help.ToString()));
        }
Exemple #14
0
        public ConsoleExecuteResult Help()
        {
            var help = new StringBuilder();

            help.AppendLine("");
            help.AppendLine(ConsoleFormatting.FixedLength("CreateQueue queueName", "Creates the queue in the transport"));
            help.AppendLine(ConsoleFormatting.FixedLength("RemoveQueue queueName", "Removes the queue from the transport"));

            help.AppendLine("Queue options (set before CreateQueue)");
            help.AppendLine("");

            help.AppendLine(ConsoleFormatting.FixedLength("SetQueueType queueName", "Type of the queue; needed for Rpc. 1=NotRpc,2=sendRpc,3=receiveRpc"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetDelayedProcessing queueName", "Enables/Disables delayed processing"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetHeartBeat queueName", "Enables/Disables heart beat support"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetMessageExpiration queueName", "Enables/Disables message expiration"));
            help.AppendLine(ConsoleFormatting.FixedLength("SetStatusTable queueName", "Enables/Disables a separate status tracking table for external code to query"));
            help.AppendLine("");
            return(new ConsoleExecuteResult(help.ToString()));
        }
        // Methods used as console commands must be public and must return a string

        public static string help()
        {
            string output = "--------\r\n" + ConsoleFormatting.Indent(1) + "options\r\n--------";

            foreach (KeyValuePair <string, Dictionary <string, IEnumerable <ParameterInfo> > > kvp in Program._commandLibraries)
            {
                foreach (KeyValuePair <string, IEnumerable <ParameterInfo> > methods in kvp.Value)
                {
                    output += "\r\n" + ConsoleFormatting.Indent(1) + methods.Key;
                    if (methods.Value.Count() > 0)
                    {
                        output += "\r\nParameters:";
                        foreach (ParameterInfo info in methods.Value)
                        {
                            output += "\r\n" + ConsoleFormatting.Indent(1) + "- " + info.Name;
                        }
                    }

                    output += "\r\n";
                }
            }
            return(output);
        }
Exemple #16
0
 public static string DoSomethingElse(DateTime date)
 {
     return(string.Format(ConsoleFormatting.Indent(2) + "I did something else on {0}", date));
 }
Exemple #17
0
        // Methods used as console commands must be public and must return a string

        public static string DoSomething(int id, string data)
        {
            return(string.Format(ConsoleFormatting.Indent(2) +
                                 "I did something to the record Id {0} and saved the data '{1}'", id, data));
        }