internal override byte[] Download() { if (_cookieCollection == null) { throw new Exception("Bloodcat No Cookie Existed."); } byte[] file; WebClient client = new WebClient(); client.AddCookie(_cookieCollection); _beatmapsetPackage.OnProgressChanged(new ProgressChangedEventArgs(0, "Downloading")); file = client.DownloadData(Path(_beatmapsetPackage)); _beatmapsetPackage.OnProgressChanged(new ProgressChangedEventArgs(90, "Download Complete")); return(file); }
public static bool IsCookieValid(CookieCollection cookieCollection) { WebClient client = new WebClient(); client.AddCookie(cookieCollection); client.Method = "Head"; //Bloodcat 对 Cookie 进行加密 与 User-Agent 配合验证 try { client.DownloadData("http://bloodcat.com/osu/s/4079"); return(true); } catch (WebException e) { Console.WriteLine(e.Message); return(false); } }