コード例 #1
0
 public static int PurchaseAll(int comicId, string cookie, int?couponId)
 {
     try
     {
         ComicInfo comic = MangaUtils.GetComicInfo(comicId, cookie);
         return(PurchaseAll(comic, cookie, couponId));
     }
     catch (Exception e)
     {
         Console.WriteLine($"Unexpected Exception encountered while Getting ComicInfo:{e}");
         return(-1);
     }
 }
コード例 #2
0
        private static int PurchaseAll(ComicInfo comic, string cookie, int?couponId)
        {
            int  count       = -1;
            bool shouldSleep = false;

            if (comic.Episodes.Any(p => p.Locked && !p.UserPurchased))
            {
                foreach (EpisodeInfo episode in comic.Episodes.Where(p => p.Locked && !p.UserPurchased).Reverse()) // 获取到的是倒序
                {
                    if (PurchaseOne(episode.Id, cookie, couponId) != 0)
                    {
                        return(count);
                    }
                    count++;
                    if (shouldSleep)
                    {
                        Thread.Sleep(300);
                    }
                    shouldSleep = true;
                }
            }
            return(count + 1);
        }