コード例 #1
0
ファイル: RssSubscription.cs プロジェクト: dodyg/hobi-hobi
        public RssSubscription(Opml opml)
            : this()
        {
            Title = opml.Title;
            DateCreated = opml.DateCreated;
            DateModified = opml.DateModified;

            var line = 0;
            foreach (var x in opml.Outlines)
            {
                line++;
                var item = new RssSubscriptionItem();
                foreach (var y in x.Attributes)
                {
                    try
                    {
                        if (y.Key == "text")
                            item.Text = y.Value;
                        else if (y.Key == "description")
                            item.Description = y.Value;
                        else if (y.Key == "title")
                            item.Title = y.Value;
                        else if (y.Key == "name")
                            item.Name = y.Value;
                        else if (y.Key == "htmlUrl" && !string.IsNullOrWhiteSpace(y.Value))
                            item.HtmlUri = new Uri(y.Value);
                        else if (y.Key == "xmlUrl" && !string.IsNullOrWhiteSpace(y.Value))
                            item.XmlUri = new Uri(y.Value);
                    }
                    catch (Exception ex)
                    {
                        ParsingErrors.Add("Error at line " + line + " in processing attribute "
                            + y.Key + " with value " + y.Value + " " +  ex.Message);
                    }
                }

                Items.Add(item);
            }
        }
コード例 #2
0
ファイル: FeedAndSource.cs プロジェクト: dodyg/hobi-hobi
 public FeedAndSource(RssSubscriptionItem source, SyndicationFeed feed)
 {
     Source = source;
     Feed = feed;
 }