| public bool Banner { get; set; } |
| public bool Help { get; set; } |
| public int Port { get; set; } |
| /// Private c'tor with default values for object instances |
| /// Use factory method instead of instatiating c'tor |
| public static Configuration CreateConfiguration(string[] args) |
| Configuration conf = new Configuration(); |
| // parse command line params |
| foreach (string arg in args) |
| else if (arg.Equals("-h")) |
| else if (arg.StartsWith("-p")) |
| conf.Port = int.Parse(arg); |
| throw new ArgumentException(string.Format("Error: {0} is not a valid port number.", arg)); |
| throw new ArgumentException(string.Format("Error: {0} is an invalid command line parameter.", arg)); |