Beispiel #1
0
        static void Main(string[] args)
        {
            var service   = new LinkService();
            var site      = new Site(name: "EmuParadise", domain: URL_BASE);
            var emulators = new List <Emulator>();
            var roms      = new List <Rom>();

            var emulatorsLink = site.AddLink(id: "3905adb3-e6b1-4262-95b5-0ef552bcfa18", url: URL_EMULATORS,
                                             expressions: new[] { REGEX_EMULATOR_ANCHORS, REGEX_EMULATOR_HREF_NAME });

            var romsLink = site.AddLink(id: "07f5a759-de52-40d5-a5ff-ce3663596532", url: URL_ROMS,
                                        expressions: new[] { REGEX_ROM_ANCHORS, REGEX_ROM_HREF_TITLE });

            // emulatorsLink.Download();
            // emulatorsLink.Response().ForEach(f => emulators.Add((Emulator)Activator.CreateInstance(typeof(Emulator), f)));

            service.Download(emulatorsLink);
            service.Extract(emulatorsLink).ForEach(f => emulators.Add((Emulator)Activator.CreateInstance(typeof(Emulator), f)));

            // romsLink.Download();
            // romsLink.Response().ForEach(f => roms.Add((Rom)Activator.CreateInstance(typeof(Rom), f)));

            service.Download(romsLink);
            service.Extract(romsLink).ForEach(f => roms.Add((Rom)Activator.CreateInstance(typeof(Rom), f)));

            // Console.Clear();
            // Console.ForegroundColor = ConsoleColor.Yellow;
            // Console.WriteLine("---------------");
            // Console.WriteLine("-  Emulators  -");
            // Console.WriteLine("---------------");

            // foreach (var emulator in emulators)
            // {
            //     Console.ForegroundColor = ConsoleColor.Green;
            //     Console.Write("=> ");
            //     Console.ForegroundColor = ConsoleColor.Cyan;
            //     Console.Write(emulator.Name);
            //     Console.Write(Environment.NewLine);
            // }

            // Console.ResetColor();

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("----------");
            Console.WriteLine("-  Roms  -");
            Console.WriteLine("----------");

            foreach (var rom in roms)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("=> ");
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write(rom.Title);
                Console.Write(Environment.NewLine);
            }

            Console.ResetColor();
        }