protected override void Run() { discoveredFeed = new NewsFeed(); try { //feedInfo = feedHandler.GetFeedDetails(this.feedUrl, this.credentials); using (Stream mem = SyncWebRequest.GetResponseStream(this.feedUrl, this.credentials, RssBanditApplication.UserAgent, this.Proxy)) { NewsFeed f = new NewsFeed(); f.link = feedUrl; if (RssParser.CanProcessUrl(feedUrl)) { feedInfo = RssParser.GetItemsForFeed(f, mem, false); if (feedInfo.ItemsList != null && feedInfo.ItemsList.Count > 0) f.containsNewMessages = true; } } } catch (ThreadAbortException) { // eat up } catch (Exception e) { // fatal errors p_operationException = e; } finally { WorkDone.Set(); } }
/// <summary> /// Authenticates a user to Feedly's services and obtains their 'code' /// </summary> private void AuthenticateUser() { string fullUrl = _authUrl + "?" + String.Format(_authBody, GetClientId(), HtmlHelper.UrlEncode("urn:rssbandit.org"), HtmlHelper.UrlEncode(AuthScope), HtmlHelper.UrlEncode("1.9.x_experimental")); try { StreamReader reader = new StreamReader(SyncWebRequest.GetResponseStream(fullUrl, null, this.Proxy)); string[] response = reader.ReadToEnd().Split('\n'); foreach (string s in response) { if (s.Contains("code=")) { this._authCode = s.Substring(s.IndexOf("code=", StringComparison.OrdinalIgnoreCase) + 5); return; } } } catch (ClientCertificateRequiredException) // Google/feedly returns a 403 instead of a 401 on invalid password { throw new ResourceAuthorizationException(); } throw new WebException("Could not authenticate user to Feedly Cloud because no authentication token provided in response", WebExceptionStatus.UnknownError); }
protected override void Run() { this.responseStream = null; try { this.responseStream = SyncWebRequest.GetResponseStream( this.requestUrl, null, RssBanditApplication.UserAgent, this.Proxy); } catch (ThreadAbortException) { // eat up } catch (Exception e) { // fatal errors this.p_operationException = e; } finally { WorkDone.Set(); } }
private Stream GetFeedSourceStream() { return(SyncWebRequest.GetResponseStream(this.feedUrl, this.feedCredentials, RssBanditApplication.UserAgent, this.proxy)); }
/// <summary> /// Loads the RSS feedlist from the given URL and validates it against the schema. /// </summary> /// <param name="feedListUrl">The URL of the feedlist</param> /// <param name="veh">The event handler that should be invoked on the client if validation errors occur</param> /// <exception cref="XmlException">XmlException thrown if XML is not well-formed</exception> private void LoadFeedlist(string feedListUrl, ValidationEventHandler veh) { LoadFeedlist(SyncWebRequest.GetResponseStream(feedListUrl, null, UserAgent, Proxy), veh); SearchHandler.CheckIndex(); }
private Stream GetWebResponseStream(string url, ICredentials credentials) { return(SyncWebRequest.GetResponseStream(url, credentials, RssBanditApplication.UserAgent, this.Proxy)); }
private Stream GetWebPage(string url) { return(SyncWebRequest.GetResponseStream(url, this.Credentials, this.userAgent, this.Proxy)); }