Options.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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', "host", Required = true, HelpText = "Host.")]
  13. public string Host { get; set; }
  14. [Option('p', "port", Required = true, HelpText = "Port.")]
  15. public int Port { get; set; }
  16. [Option("protocol", Required = true, HelpText = "Protocol, tcp or udp.")]
  17. public NetworkProtocol Protocol { get; set; }
  18. [Option('v', HelpText = "Print details during execution.")]
  19. public bool Verbose { get; set; }
  20. [HelpOption]
  21. public string GetUsage()
  22. {
  23. // this without using CommandLine.Text
  24. StringBuilder usage = new StringBuilder();
  25. usage.AppendLine("Quickstart Application 1.0");
  26. usage.AppendLine("Read user manual for usage instructions...");
  27. return usage.ToString();
  28. }
  29. }
  30. }