Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Application.Start(Environment.Exit);
            // This is extremely important to enable high throughput
            // of individual messages
            ServicePointManager.UseNagleAlgorithm = false;
            ServicePointManager.DefaultConnectionLimit = 48;

            var options = new ClientOptions();

                if (!CommandLine.CommandLineParser.Default.ParseArguments(args, options))
                {
                    Console.WriteLine(options.GetUsage());
                    return;
                }

            try
            {
                if (options.Command.Count == 0 && File.Exists("Readme.md"))
                {
                    Console.WriteLine(File.ReadAllText("Readme.md"));
                }

                foreach (var pair in options.GetPairs())
                {
                    Console.WriteLine("  {0,15} : {1}", pair.Key.ToUpperInvariant(), pair.Value);
                }
                Console.WriteLine();

                var client = new Client(options);
                client.Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine("ERROR:");
                Console.Write(exception.Message);
                Console.WriteLine();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Application.Start(Environment.Exit);

            var clientOptions = new ClientOptions
                                    {
                                        Ip = args.Length > 0 ? args[0] : "127.0.0.1",
                                        HttpPort = args.Length > 1 ? args[1] : "8080",
                                        Timeout = args.Length > 2 ? int.Parse(args[2]) : -1,
                                        Command = args.Length > 3 ? args.Skip(3).ToList() : new List<string>(),
                                    };

            var client = new Client(clientOptions);
            try
            {
                client.Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine("ERROR:");
                Console.Write(exception.Message);
                Console.WriteLine();
            }
        }
 public CommandProcessorContext(Client client, ILogger log, ManualResetEvent resetEvent)
 {
     Log = log;
     Client = client;
     _resetEvent = resetEvent;
 }
 public CommandProcessorContext(Client client, ILogger log)
 {
     Log = log;
     Client = client;
 }