Options.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Text;
  2. using Base;
  3. #if SERVER
  4. using CommandLine;
  5. #endif
  6. namespace Model
  7. {
  8. public class Options
  9. {
  10. #if SERVER
  11. [Option("appType", Required = true, HelpText = "AppType: realm gate")]
  12. #endif
  13. public string AppType { get; set; }
  14. #if SERVER
  15. [Option("id", Required = true, HelpText = "Id.")]
  16. #endif
  17. public int Id { get; set; }
  18. #if SERVER
  19. [Option("protocol", Required = false, HelpText = "Protocol, tcp or udp.", DefaultValue = NetworkProtocol.UDP)]
  20. #endif
  21. public NetworkProtocol Protocol { get; set; }
  22. #if SERVER
  23. [Option("host", Required = true, HelpText = "Host.")]
  24. #endif
  25. public string Host { get; set; }
  26. #if SERVER
  27. [Option("port", Required = true, HelpText = "Port.")]
  28. #endif
  29. public int Port { get; set; }
  30. #if SERVER
  31. [Option("gateHost", Required = false, HelpText = "GateHost.")]
  32. #endif
  33. public string GateHost { get; set; }
  34. #if SERVER
  35. [Option("gatePort", Required = false, HelpText = "GatePort.")]
  36. #endif
  37. public int GatePort { get; set; }
  38. #if SERVER
  39. [Option('v', HelpText = "Print details during execution.")]
  40. #endif
  41. public bool Verbose { get; set; }
  42. #if SERVER
  43. [HelpOption]
  44. #endif
  45. public string GetUsage()
  46. {
  47. // this without using CommandLine.Text
  48. StringBuilder usage = new StringBuilder();
  49. usage.AppendLine("Quickstart Application 1.0");
  50. usage.AppendLine("Read user manual for usage instructions...");
  51. return usage.ToString();
  52. }
  53. }
  54. }