Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Advent 2020\n");
            Day[] Days = new Day[26];
            Days[1]  = new Day1();
            Days[2]  = new Day2();
            Days[3]  = new Day3();
            Days[4]  = new Day4();
            Days[5]  = new Day5();
            Days[6]  = new Day6();
            Days[7]  = new Day7();
            Days[8]  = new Day8();
            Days[9]  = new Day9();
            Days[10] = new Day10();
            Days[11] = new Day11();
            Days[12] = new Day12();
            Days[13] = new Day13();
            Days[14] = new Day14();
            Days[15] = new Day15();
            Days[16] = new Day16();
            Days[17] = new Day17();
            Days[18] = new Day18();
            Days[19] = new Day19();
            Days[20] = new Day20();
            Days[21] = new Day21();
            Days[22] = new Day22();
            Days[23] = new Day23();
            Days[24] = new Day24();
            Days[25] = new Day25();

            string[] argv = System.Environment.GetCommandLineArgs();
            if (argv.Length < 2)
            {
                for (int i = 1; i < 26; i++)
                {
                    if (Days[i] != null)
                    {
                        Days[i].Run().Print();
                    }
                }
            }
            else
            {
                for (int i = 1; i < argv.Length; i++)
                {
                    int day;
                    if (int.TryParse(argv[i], out day) && day > 0 && day < 26 && Days[day] != null)
                    {
                        Days[day].Run().Print();
                    }
                }
            }
        }
Пример #2
0
        private Day CanIHasDay(int _day, string _input)
        {
            Day ReturnDay;

            switch (_day)
            {
            case 1:
                ReturnDay = new Day01(_input);
                break;

            case 2:
                ReturnDay = new Day02(_input);
                break;

            case 3:
                ReturnDay = new Day03(_input);
                break;

            case 4:
                ReturnDay = new Day04(_input);
                break;

            case 5:
                ReturnDay = new Day05(_input);
                break;

            case 6:
                ReturnDay = new Day06(_input);
                break;

            case 7:
                ReturnDay = new Day07(_input);
                break;

            case 8:
                ReturnDay = new Day08(_input);
                break;

            case 9:
                ReturnDay = new Day09(_input);
                break;

            case 10:
                ReturnDay = new Day10(_input);
                break;

            case 11:
                ReturnDay = new Day11(_input);
                break;

            case 12:
                ReturnDay = new Day12(_input);
                break;

            case 13:
                ReturnDay = new Day13(_input);
                ReturnDay.SetMainView(_mainView);
                break;

            case 14:
                ReturnDay = new Day14(_input);
                break;

            case 15:
                ReturnDay = new Day15(_input);
                break;

            case 16:
                ReturnDay = new Day16(_input);
                break;

            case 17:
                ReturnDay = new Day17(_input);
                break;

            case 18:
                ReturnDay = new Day18(_input);
                break;

            case 19:
                ReturnDay = new Day19(_input);
                break;

            case 20:
                ReturnDay = new Day20(_input);
                break;

            case 21:
                ReturnDay = new Day21(_input);
                break;

            case 22:
                ReturnDay = new Day22(_input);
                break;

            case 23:
                ReturnDay = new Day23(_input);
                break;

            case 24:
                ReturnDay = new Day24(_input);
                break;

            case 25:
                ReturnDay = new Day25(_input);
                break;

            default:
                ReturnDay = new Day01(_input);
                break;
            }
            return(ReturnDay);
        }