Exemplo n.º 1
0
        /// <summary>
        /// Overloaded. Initializer
        /// </summary>
        /// <param name="id"></param>
        /// <param name="feedLocation"></param>
        /// <param name="itemsList"></param>
        /// <param name="title"></param>
        /// <param name="link"></param>
        /// <param name="description"></param>
        /// <param name="optionalElements"></param>
        /// <param name="language"></param>
        public FeedInfo(string id, string feedLocation, IEnumerable <INewsItem> itemsList, string title, string link,
                        string description, IDictionary <XmlQualifiedName, string> optionalElements, string language)
        {
            this.id               = id;
            this.feedLocation     = feedLocation;
            this.itemsList        = itemsList != null ? new List <INewsItem>(itemsList) : new List <INewsItem>();
            this.title            = title;
            this.link             = link;
            this.description      = description;
            this.optionalElements = optionalElements != null ? new Dictionary <XmlQualifiedName, string>(optionalElements) : new Dictionary <XmlQualifiedName, string>();
            this.language         = language;

            if (RssHelper.IsNntpUrl(link))
            {
                type = FeedType.Nntp;
            }
            else
            {
                type = FeedType.Rss;
            }
        }
Exemplo n.º 2
0
        public FeedProperties(string title, string link, int refreshRate, TimeSpan maxItemAge, string currentCategory, string defaultCategory, ICollection <string> categories, string stylesheet) :
            this()
        {
            this.textBox1.Text = title;
            this.textBox2.Text = link;

            this.comboBox1.Items.Clear();
            if (!Utils.RefreshRateStrings.Contains(refreshRate.ToString()))
            {
                Utils.RefreshRateStrings.Add(refreshRate.ToString());
            }
            this.comboBox1.DataSource = Utils.RefreshRateStrings;
            this.comboBox1.Text       = refreshRate.ToString();

            tabAuthentication.Enabled = !RssHelper.IsNntpUrl(link);
            ClientCertificate         = null;

            //initialize category combo box
            foreach (string category in categories)
            {
                if (!string.IsNullOrEmpty(category))
                {
                    this.comboBox2.Items.Add(category);
                }
            }
            this.comboBox2.Items.Add(defaultCategory);
            if (currentCategory != null)
            {
                this.comboBox2.Text = currentCategory;
            }

            this.MaxItemAge = maxItemAge;
            this.checkEnableAlerts.Checked = false;

            // item formatters
            string tmplFolder = RssBanditApplication.GetTemplatesPath();

            this.checkCustomFormatter.Enabled = false;
            this.comboFormatters.Items.Clear();

            if (Directory.Exists(tmplFolder))
            {
                string[] tmplFiles = Directory.GetFiles(tmplFolder, "*.fdxsl");

                if (tmplFiles.GetLength(0) > 0)
                {
                    this.checkCustomFormatter.Enabled = true;
                    foreach (string filename in tmplFiles)
                    {
                        this.comboFormatters.Items.Add(Path.GetFileNameWithoutExtension(filename));
                    }
                }

                if (!string.IsNullOrEmpty(stylesheet) &&
                    File.Exists(Path.Combine(tmplFolder, stylesheet + ".fdxsl")))
                {
                    this.comboFormatters.Text         = stylesheet;
                    this.checkCustomFormatter.Checked = true;
                }
            }
            else
            {
                this.comboFormatters.Text         = String.Empty;
                this.checkCustomFormatter.Checked = false;
            }

            this.checkCustomFormatter_CheckedChanged(null, null);
            this.comboFormatters.Refresh();
        }