Ejemplo n.º 1
0
        private void lstForumType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                string name = (string)(this.lstForumType.SelectedItem as ListBoxItem).Tag;

                this.leechClient.PostSite        = DefaultSiteTypes.ByName(name).CreateInstance();
                this.leechClient.PostSite.Login += new LoginEventHandler(PostSite_Login);
            }
            catch { }
        }
Ejemplo n.º 2
0
        public SiteReader(string siteName, string baseUrl, string siteTypeName, int topicsPerPage, Dictionary <string, int> sections,
                          string defaultEncoding = "", bool allowRedirects = false, bool useFriendlyLinks = false)
        {
            SiteType siteType = DefaultSiteTypes.ByName(siteTypeName).CreateInstance();
            Uri      uri;

            if (siteName == null)
            {
                throw new NullReferenceException("siteName cannot be null.");
            }
            else if (sections == null)
            {
                throw new NullReferenceException("sections cannot be null.");
            }
            else if (!Uri.TryCreate(baseUrl, UriKind.Absolute, out uri))
            {
                throw new ArgumentOutOfRangeException(
                          "baseUrl", baseUrl,
                          "The provided base URL is invalid."
                          );
            }

            this.SiteName              = siteName;
            this.Sections              = sections;
            this.TopicsPerPage         = (topicsPerPage == null || topicsPerPage < 1) ? 20 : topicsPerPage;
            this.Type                  = siteType;
            this.Type.BaseUrl          = baseUrl;
            this.Type.AllowRedirects   = allowRedirects;
            this.Type.UseFriendlyLinks = useFriendlyLinks;

            if (defaultEncoding != null || defaultEncoding != String.Empty)
            {
                this.Type.SiteEncoding = Encoding.GetEncoding(defaultEncoding);
            }

            this.Init();
        }