Exemple #1
0
        public HdojFetcher(int cid, DataHolder data, string username, string userpass, int lop, ILogger logger)
        {
            _data   = data;
            _cid    = cid;
            _lop    = lop;
            _logger = logger;

            var handler = new HttpClientHandler();

            handler.UseCookies        = true;
            handler.CookieContainer   = new CookieContainer();
            handler.AllowAutoRedirect = false;

            _httpClient             = new HttpClient(handler);
            _httpClient.BaseAddress = new Uri("http://acm.hdu.edu.cn/");

            _loginContent = new FormUrlEncodedContent(new Dictionary <string, string>
            {
                ["login"]    = "******",
                ["username"] = username,
                ["userpass"] = userpass,
            });
        }