Exemplo n.º 1
0
        protected WebClient WebClient()
        {
            WebClient client = new WebClient();

            client.AddCookie(_cookieCollection);
            return(client);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public static bool IsCookieValid(CookieCollection cookieCollection)
        {
            WebClient client = new WebClient();

            client.AddCookie(cookieCollection);
            string s = client.DownloadString(Path(Methods.user));

            ReturnInformation.User user = JsonConvert.DeserializeObject <ReturnInformation.User>(s);
            if (user.logged_in)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }