diff --git a/zsirozas/Program.cs b/zsirozas/Program.cs index 115b00c8d6388478eff7e274a2fe1553eebfc99f..3e73c253126b9772984ebfa942a4c81c4f3a1366 100644 --- a/zsirozas/Program.cs +++ b/zsirozas/Program.cs @@ -35,7 +35,7 @@ namespace zsirozas //client options // - [Option("connect", SetName = "toplevel", HelpText = "Connect to the specified game server using the RawTcp protocol.", MetaValue = "IP PORT LISTENPORT", Min = 3, Max = 3)] + [Option("connect", SetName = "toplevel", HelpText = "Connect to the specified game server using the RawTcp protocol.\nThe server will push to LISTENPORT.", MetaValue = "IP PORT LISTENPORT", Min = 3, Max = 3)] public IEnumerable<string> TcpConnectParams { get; set; } [Option("connect-signalr", SetName = "toplevel", HelpText = "Connect to server with SignalR instead.", MetaValue = "URL")] @@ -50,15 +50,34 @@ namespace zsirozas { public static void Main(string[] args) { - if (args.Contains("--server")) + //if (args.Contains("--server")) + //{ + // var srv = new GameServer(args.Contains("--bigroom"), args.Contains("--oneshot")); + // new ServerWrapper(srv).Run(args.Contains("--signalr"), !args.Contains("--notcp")); + //} + //else + //{ + // Application.Run(new Form1()); + //} + Parser.Default.ParseArguments<CommandLineOptions>(args).WithParsed((options) => { - var srv = new GameServer(args.Contains("--bigroom"), args.Contains("--oneshot")); - new ServerWrapper(srv).Run(args.Contains("--signalr"), !args.Contains("--notcp")); - } - else - { - Application.Run(new Form1()); - } + if (options.StartServer) + { + var srv = new GameServer(options.BigRoom, options.OneShot); + new ServerWrapper(srv).Run(options.StartSignalR, !options.NoTcp); + } + else + { + if (options.WithConsole) + { + Console.WriteLine("This is not yet supported. Sorry :("); + } + else + { + Application.Run(new Form1()); + } + } + }); } } }