Example #1
0
        private static ArgsOption ParseArgs(string[] args)
        {
            Log.Information($"Parse arguments...");
            var argsOption = new ArgsOption();
            var result     = Parser.Default.ParseArguments <ArgsOption>(args)
                             .WithParsed(options => argsOption = options)
                             .WithNotParsed(error =>
            {
                argsOption = null;
            });

            return(argsOption);
        }
Example #2
0
        private static RpcConfig GenConfig(ArgsOption option)
        {
            var logTarget = RpcLogTargetEnum.All;

            if (option.LogTarget == LogTargetEnum.Console)
            {
                logTarget = RpcLogTargetEnum.Console;
            }
            else if (option.LogTarget == LogTargetEnum.File)
            {
                logTarget = RpcLogTargetEnum.File;
            }
            var config = new RpcConfig()
            {
                PidFile      = option.PidFile,
                LogTarget    = logTarget,
                LogName      = option.LogName,
                LogDirectory = option.LogDirectory,
                RpcPort      = option.RpcPort,
                HostName     = option.HostName
            };

            return(config);
        }