コード例 #1
0
        private List <Page> CreatePages(Settings settings)
        {
            List <List <string> > boosters;

            if (settings.Lands)
            {
                boosters = GetLandBoosters(settings);
            }
            else
            {
                boosters = GetBoosters(settings);
            }

            PagePointer p          = new PagePointer();
            List <Page> imagePages = new List <Page>();
            List <Page> textPages  = new List <Page>();
            Page        imagePage  = new Page();
            Page        textPage   = new Page();

            for (int i = 0; i < boosters.Count; i++)
            {
                var booster = boosters[i];
                foreach (var card in booster)
                {
                    if (p.Inc())
                    {
                        imagePage = new Page {
                            IsGrid = false
                        };
                        imagePages.Add(imagePage);
                        textPage = new Page {
                            IsGrid = true
                        };
                        textPages.Add(textPage);
                    }

                    imagePage.Images[p.I, p.J]   = card;
                    textPage.Texts[p.I, 2 - p.J] = settings.Lands ? "L" : GetText(i + 1);
                }
                if (!settings.MergePages)
                {
                    p.SetEnd();
                }
            }

            List <Page> pages = new List <Page>();

            if (settings.NormalOrder)
            {
                for (int i = 0; i < imagePages.Count; i++)
                {
                    pages.Add(imagePages[i]);
                    pages.Add(textPages[i]);
                }
            }
            else
            {
                pages.AddRange(imagePages);
                pages.AddRange(textPages);
            }

            return(pages);
        }
コード例 #2
0
        private List<Page> CreatePages(Settings settings)
        {
            List<List<string>> boosters;
            if (settings.Lands)
            {
                boosters = GetLandBoosters(settings);
            }
            else
            {
                boosters = GetBoosters(settings);
            }

            PagePointer p = new PagePointer();
            List<Page> imagePages = new List<Page>();
            List<Page> textPages = new List<Page>();
            Page imagePage = new Page();
            Page textPage = new Page();
            for (int i = 0; i < boosters.Count; i++)
            {
                var booster = boosters[i];
                foreach (var card in booster)
                {
                    if (p.Inc())
                    {
                        imagePage = new Page { IsGrid = false };
                        imagePages.Add(imagePage);
                        textPage = new Page { IsGrid = true };
                        textPages.Add(textPage);
                    }

                    imagePage.Images[p.I, p.J] = card;
                    textPage.Texts[p.I, 2 - p.J] = settings.Lands ? "L" : GetText(i + 1);
                }
                if (!settings.MergePages)
                {
                    p.SetEnd();
                }
            }

            List<Page> pages = new List<Page>();
            if (settings.NormalOrder)
            {
                for (int i = 0; i < imagePages.Count; i++)
                {
                    pages.Add(imagePages[i]);
                    pages.Add(textPages[i]);
                }
            }
            else
            {
                pages.AddRange(imagePages);
                pages.AddRange(textPages);
            }

            return pages;
        }