Example #1
0
        public void DownloadGathererImages(string setCode)
        {
            var client = new GathererClient();
            var set    = Repo.SetsByCode[setCode];

            foreach (var card in set.Cards)
            {
                client.DownloadCardImage(card, GathererOriginalDir);
            }
        }
Example #2
0
        public void DownloadGathererImages(string setCode, bool useCustomSet)
        {
            var repo = new CardRepository();

            if (useCustomSet)
            {
                repo.SetsFile       = null;
                repo.CustomSetCodes = new[] { setCode };
            }

            repo.FilterSetCode = code => Str.Equals(code, setCode);

            repo.LoadFile();
            repo.Load();

            var set    = repo.SetsByCode[setCode];
            var client = new GathererClient();

            var setDirectory = Path.Combine(GathererOriginalDir, set.Code);

            Directory.CreateDirectory(setDirectory);

            foreach (var card in set.Cards)
            {
                if (!card.MultiverseId.HasValue)
                {
                    continue;
                }

                string targetFile    = Path.Combine(setDirectory, card.ImageName + ".png");
                string processedFile = Path.Combine(setDirectory, card.ImageName + ".jpg");

                if (File.Exists(targetFile) || File.Exists(processedFile))
                {
                    continue;
                }

                client.DownloadCardImage(card.MultiverseId.Value, targetFile);
            }
        }