예제 #1
0
        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();
        }
예제 #2
0
        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
        }