Пример #1
0
        /// <summary>
        /// Retrieve premade packs from Redump
        /// </summary>
        /// <param name="wc">CookieAwareWebClient to hold the login state</param>
        /// <param name="system">RedumpSystem to get all possible packs for</param>
        private void ProcessPacksForSystem(CookieAwareWebClient wc, RedumpSystem system)
        {
            var packs = new Dictionary <string, byte[]>();

            if (Extensions.HasCues.Contains(system))
            {
                packs.Add("cues", this.DownloadPack(wc, packCuesUrl, system, "CUEs"));
            }

            if (Extensions.HasDat.Contains(system))
            {
                packs.Add("dat", this.DownloadPack(wc, packDatfileUrl, system, "DATs"));
            }

            if (Extensions.HasDkeys.Contains(system))
            {
                packs.Add("dkeys", this.DownloadPack(wc, packDkeysUrl, system, "Decrypted KEYS"));
            }

            if (Extensions.HasGdi.Contains(system))
            {
                packs.Add("gdi", this.DownloadPack(wc, packGdiUrl, system, "GDIs"));
            }

            if (Extensions.HasKeys.Contains(system))
            {
                packs.Add("keys", this.DownloadPack(wc, packKeysUrl, system, "KEYS"));
            }

            if (Extensions.HasSbi.Contains(system))
            {
                packs.Add("sbi", this.DownloadPack(wc, packSbiUrl, system, "SBIs"));
            }
        }
Пример #2
0
        /// <summary>
        /// Download an individual pack
        /// </summary>
        /// <param name="wc">CookieAwareWebClient to access the packs</param>
        /// <param name="url">Base URL to download using</param>
        /// <param name="system">System to download packs for</param>
        /// <param name="title">Name of the pack that is downloading</param>
        private byte[] DownloadPack(CookieAwareWebClient wc, string url, RedumpSystem system, string title)
        {
            Console.WriteLine($"Downloading {title}");
            Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}");
            var pack = wc.DownloadData(string.Format(url, system.ShortName()));

            Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}");
            Console.WriteLine();

            return(pack);
        }