示例#1
0
 private static ServerOptions TranslateConfig(ArgumentOptions config)
 {
     return(new ServerOptions()
     {
         Debug = config.Debug
     });
 }
示例#2
0
        static void Main(string[] args)
        {
            var config    = new ArgumentOptions();
            var optionSet = new OptionSet {
                { "d|debug", GetHelpText(() => config.Debug), v => config.Debug = v != null },
                { "h|help", GetHelpText(() => config.ShowHelp), v => config.ShowHelp = v != null }
            };

            try
            {
                optionSet.Parse(args);
            }
            catch (OptionException ex)
            {
                Die(ex.Message);
            }

            if (config.ShowHelp)
            {
                ShowHelpMessage(optionSet);
            }

            using (var server = new GolemServer())
            {
                server.Main(TranslateConfig(config));
            }
        }