Options.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Text;
  2. using CommandLine;
  3. using Common.Network;
  4. namespace Model
  5. {
  6. public class Options
  7. {
  8. [Option('s', "serverType", Required = true, HelpText = "ServerType.")]
  9. public ServerType ServerType { get; set; }
  10. [Option('n', "name", Required = true, HelpText = "Name.")]
  11. public string Name { get; set; }
  12. [Option('h', "gateHost", Required = false, HelpText = "GateHost.")]
  13. public string GateHost { get; set; }
  14. [Option('p', "gatePort", Required = false, HelpText = "GatePort.")]
  15. public int GatePort { get; set; }
  16. [Option('h', "host", Required = true, HelpText = "Host.")]
  17. public string Host { get; set; }
  18. [Option('p', "port", Required = true, HelpText = "Port.")]
  19. public int Port { get; set; }
  20. [Option("protocol", Required = true, HelpText = "Protocol, tcp or udp.")]
  21. public NetworkProtocol Protocol { get; set; }
  22. [Option('v', HelpText = "Print details during execution.")]
  23. public bool Verbose { get; set; }
  24. [HelpOption]
  25. public string GetUsage()
  26. {
  27. // this without using CommandLine.Text
  28. StringBuilder usage = new StringBuilder();
  29. usage.AppendLine("Quickstart Application 1.0");
  30. usage.AppendLine("Read user manual for usage instructions...");
  31. return usage.ToString();
  32. }
  33. }
  34. }