public async Task <ImageInfo> SelectArtWork() { if (c.account.Equals("") || c.password.Equals("")) { return(null); } if (pixiv.token == null || pixiv.token.Equals("")) { if (c.token.Equals("")) { if (!await pixiv.getToken(true)) { return(null); } else { c.cookie = pixiv.cookie; c.token = pixiv.token; } } else { pixiv.cookie = c.cookie; pixiv.token = c.token; } } await ListUpdate(); ImageInfo img = null; if (like != null && like.Count != 0) { Random r = new Random(); while (true) { int number = r.Next(0, like.Count); string id = like[number].ToString(); img = await pixiv.getImageInfo(id); if (like[number] != null && img.WHratio >= 1.33) { await pixiv.downloadImg(img); break; } else { like.RemoveAt(number); } } } return(img); }
/// <summary> /// 作品推送 /// </summary> /// <returns></returns> public async Task <ImageInfo> SelectArtWork() { await listUpdate(); ImageInfo img = null; if (results != null && results.Count > 0) { while (true) { Random r = new Random(); int number = r.Next(0, 50); if (results[number] != null) { string imgid = results[number].ToString(); img = await p.getImageInfo(imgid); } break; } await p.downloadImg(img); } return(img); }