Command line options for the client
Inheritance: CommandLineOptionsBase
示例#1
0
        public Client(ClientOptions clientOptions)
        {
            Options = clientOptions;
            JsonClient = new JsonServiceClient(string.Format("http://{0}:{1}", clientOptions.Ip, clientOptions.HttpPort));

            _interactiveMode = clientOptions.Command.IsEmpty();

            RegisterCommand();
        }
示例#2
0
        public Client(ClientOptions options)
        {
            Options = options;
            // TODO : pass server options
            ClientHttpBase = string.Format("http://{0}:{1}", options.Ip, options.HttpPort);
            Views = PlatformClient.ConnectToViewStorage(options.StoreLocation, options.ViewsFolder);

            UseEventStore("default");

            RegisterCommands();
        }
示例#3
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();
            }
        }
示例#4
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();
            }
        }