Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var config = new CommandLineParser.Arguments.FileArgument('c', "config")
            {
                ForcedDefaultValue = new FileInfo("config.json")
            };

            var verbose = new CommandLineParser.Arguments.SwitchArgument('v', "verbose", false);

            var commandLineParser = new CommandLineParser.CommandLineParser()
            {
                Arguments =
                {
                    config,
                    verbose,
                }
            };

            try
            {
                commandLineParser.ParseCommandLine(args);

                AsyncMain(new ConfigurationBuilder()
                          .AddJsonFile(config.Value.FullName, true)
                          .Build(), verbose.Value).Wait();
            }
            catch (CommandLineParser.Exceptions.CommandLineException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 2
0
        static void ParseCommandLine(string[] args, out CommandLineParser.Arguments.FileArgument config, out CommandLineParser.Arguments.SwitchArgument debug, out CommandLineParser.Arguments.SwitchArgument fetch, out CommandLineParser.Arguments.SwitchArgument summary)
        {
            config = new CommandLineParser.Arguments.FileArgument('c', "config")
            {
                ForcedDefaultValue = new FileInfo("config.json")
            };

            debug = new CommandLineParser.Arguments.SwitchArgument('d', "debug", false);

            fetch = new CommandLineParser.Arguments.SwitchArgument('f', "fetch", false);

            summary = new CommandLineParser.Arguments.SwitchArgument('s', "summary", false);

            var commandLineParser = new CommandLineParser.CommandLineParser()
            {
                Arguments =
                {
                    config,
                    debug,
                    fetch,
                    summary,
                }
            };

            commandLineParser.ParseCommandLine(args);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var config = new CLP.Arguments.FileArgument('c', "config")
            {
                ForcedDefaultValue = new FileInfo("config.json"),
            };
            var verbose = new CLP.Arguments.SwitchArgument('v', "verbose", false);
            var offset  = new CLP.Arguments.ValueArgument <int>('o', "offset")
            {
                ForcedDefaultValue = 0,
            };
            var range = new CLP.Arguments.ValueArgument <int>('r', "range")
            {
                ForcedDefaultValue = 1,
            };

            var commandLineParser = new CLP.CommandLineParser()
            {
                Arguments =
                {
                    config,
                    verbose,
                    offset,
                    range,
                }
            };

            try
            {
                commandLineParser.ParseCommandLine(args);

                Main(new ConfigurationBuilder()
                     .AddJsonFile(config.Value.FullName, true)
                     .Build(), LoadConfig(config.Value.FullName), verbose.Value, offset.Value, range.Value)
                .Wait();
            }
            catch (CLP.Exceptions.CommandLineException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 4
0
        static void InitCLParser()
        {
            var loginIdArg = new CommandLineParser.Arguments.ValueArgument <string>('u', "username", "DMM Login ID")
            {
                Optional      = false,
                AllowMultiple = false
            };
            var pwdArg = new CommandLineParser.Arguments.ValueArgument <string>('p', "password", "DMM Login password")
            {
                Optional      = false,
                AllowMultiple = false
            };

            var fTimeArg = new CommandLineParser.Arguments.ValueArgument <int>('t', "time", "Specify how much waiting time for each monitoring cycle.")
            {
                Optional      = true,
                AllowMultiple = false
            };

            var asArg = new CommandLineParser.Arguments.SwitchArgument('a', "api_start2", "Enable monitor new ships and equipments from api_start2 module.", false)
            {
                Optional      = true,
                AllowMultiple = false,
            };

            var swfArg = new CommandLineParser.Arguments.SwitchArgument('s', "clientSwf", "Enable monitor kancolle client swf files module.", false)
            {
                Optional      = true,
                AllowMultiple = false,
            };

            m_clParser.Arguments.Add(loginIdArg);
            m_clParser.Arguments.Add(pwdArg);
            m_clParser.Arguments.Add(fTimeArg);
            m_clParser.Arguments.Add(asArg);
            m_clParser.Arguments.Add(swfArg);
        }