public void Main(string argument) { if (!string.IsNullOrEmpty(argument)) { string key = null; int delay = -1; if (argument.Contains(",")) { string[] parts = argument.Split(','); if (parts.Length >= 2) { if (!Int32.TryParse(parts[0], out delay)) { key = parts[0]; } else { Int32.TryParse(parts[1], out delay); } } } else { if (!Int32.TryParse(argument, out delay)) { key = argument; } } if (key != doors.Key || doors.Delay != delay) { doors = new AutoCloseDoors(this, key, delay); } } doors.Run(); }
public Program() { doors = new AutoCloseDoors(this); }