public static void SmartDraw(ConsoleFormatter cf, Command cp) { Timer startTimer = new Timer(cp.StartTime); Timer endTimer = new Timer(cp.EndTime); startTimer.Elapsed += async(sender, args) => { if (cp.HasParams) { await cf.DrawText(Positions(cp.Position), Colors(cp.Color), cp.Text); } else { await cf.DrawText(Position.No, ConsoleColor.White, cp.Text); } startTimer.Stop(); }; endTimer.Elapsed += (sender, args) => { cf.EraseText(cp.Text); endTimer.Stop(); }; startTimer.Start(); endTimer.Start(); }
public static void Main() { ConsoleFormatter cf = new ConsoleFormatter(); foreach (string line in new FileReader("input.txt")) { DrawEngine.SmartDraw(cf, new Command(line)); } Console.ReadKey(); //prevents console close }