Esempio n. 1
0
        public static double GetCountdown()
        {
            var jsonStr = BaiduNet.GetForum(null).Result;
            var reply   = new ErrorReply();

            reply.Parse(jsonStr);

            var nextDay = DateTime.UtcNow.AddHours(8).Date.AddDays(1);

            Console.WriteLine($@"下次签到时间:{nextDay.ToString(CultureInfo.CurrentCulture)}");

            var now = reply.Time.ToUniversalTime().AddHours(8);

            Console.WriteLine($@"现在时间:{now.ToString(CultureInfo.CurrentCulture)}");

            return((nextDay - now).TotalMilliseconds);
        }
Esempio n. 2
0
        private async Task SignAll(int retryTime)
        {
            var forums = new ForumList();

            try
            {
                var forumStr = await BaiduNet.GetForum(BDUSS);

                forums.Parse(forumStr);
                Console.WriteLine(@"获取贴吧列表成功!");
                Console.WriteLine(forums.ToString());
            }
            catch
            {
                Console.WriteLine(@"获取贴吧列表失败!");
                return;
            }

            int          success;
            List <Forum> failList;


            (success, failList) = await SignAll(forums.Forums, forums.Tbs);

            if (success != forums.Forums.Count)
            {
                Console.WriteLine(@"存在签到失败贴吧,重试开始");
                for (var i = 0; i < retryTime; ++i)
                {
                    Console.WriteLine($@"第 {i + 1} 次重试");
                    int successT;
                    (successT, failList) = await SignAll(failList, forums.Tbs);

                    success += successT;
                    if (success == forums.Forums.Count)
                    {
                        break;
                    }
                }
            }

            Console.WriteLine($@"签到完成:{success}/{forums.Forums.Count}");
        }