private static int GetLightTime(LightColor light) { string lightTime = string.Empty; do { Console.ForegroundColor = (ConsoleColor)light; Console.WriteLine($"请输入{light.GetEnumDes()}时间:"); Console.ForegroundColor = (ConsoleColor)light; lightTime = Console.ReadLine(); } while (lightTime.TryToInt() == 0); return(lightTime.TryToInt()); }