示例#1
0
 public TChannelImage()
 {
     Title  = "";
     Url    = new TUri();
     Width  = 0;
     Height = 0;
 }
示例#2
0
 public TChannelImage(TChannelImage image)
 {
     Title  = image.Title;
     Url    = new TUri(image.Url);
     Width  = image.Width;
     Height = image.Height;
 }
示例#3
0
 public TChannel(TOpmlOutline opmlOutline)
     : this()
 {
     Name        = opmlOutline.Title;
     Title       = opmlOutline.Title;
     Link        = new TUri(opmlOutline.XmlUrl.ToString());
     Description = opmlOutline.Description;
 }
示例#4
0
 public TUri(TUri uri)
     : this()
 {
     try {
         Value = new Uri(uri.Value.ToString());
     } catch (Exception ex) {
         Trace.WriteLine(string.Format("Unable to create TUri from Uri \"{0)\" : {1}", uri.ToString(), ex.Message));
     }
 }
示例#5
0
 public TItem(TItem item)
 {
     Link        = new TUri(item.Link);
     Title       = item.Title;
     Description = item.Description;
     PubDate     = item.PubDate;
     Enclosure   = new TEnclosure(item.Enclosure);
     IsRead      = item.IsRead;
 }
示例#6
0
 public TItem()
 {
     Link        = new TUri();
     Title       = "";
     Description = "";
     PubDate     = DateTime.MinValue;
     Enclosure   = new TEnclosure();
     IsRead      = false;
 }
示例#7
0
 public TEnclosure(TEnclosure enclosure)
     : this()
 {
     if (enclosure != null)
     {
         Url      = new TUri(enclosure.Url);
         Length   = enclosure.Length;
         Mimetype = enclosure.Mimetype;
     }
 }
示例#8
0
 public TChannelImage(XElement image)
 {
     Title = image.SafeReadElementValue <string>("title", "");
     Url   = new TUri(image.SafeReadElementValue <string>("url", ""));
     if (image.Elements().Any(x => x.Name == "width"))
     {
         Width = image.SafeReadElementValue <int>("width", 0);
     }
     if (image.Elements().Any(x => x.Name == "height"))
     {
         Height = image.SafeReadElementValue <int>("height", 0);
     }
 }
示例#9
0
 public TChannel()
 {
     Name            = "";
     Title           = "";
     Link            = new TUri();
     Description     = "";
     Category        = "";
     Language        = "";
     Copyright       = "";
     LastBuildDate   = DateTime.MinValue;
     Picture         = new TChannelImage();
     Items           = new TItemCollection();
     ChannelEncoding = null;
 }
示例#10
0
 public TChannel(TChannel channel)
     : this()
 {
     Name            = channel.Name;
     Title           = channel.Title;
     Link            = new TUri(channel.Link);
     Description     = channel.Description;
     Category        = channel.Category;
     Language        = channel.Language;
     Copyright       = channel.Copyright;
     LastBuildDate   = channel.LastBuildDate;
     Picture         = new TChannelImage(channel.Picture);
     Items           = new TItemCollection(channel.Items);
     ChannelEncoding = channel.ChannelEncoding;
 }
示例#11
0
 public TItem(XElement item)
 {
     Link        = new TUri(item.SafeReadElementValue <string>("link", ""));
     Title       = item.SafeReadElementValue <string>("title", "");
     Description = item.SafeReadElementValue <string>("description", "");
     PubDate     = item.SafeReadElementValue <DateTime>("pubDate", DateTime.MinValue, CultureInfo.InvariantCulture);
     if (item.Attributes().Any(x => x.Name == "isread"))
     {
         IsRead = item.SafeReadAttribute <bool>("isread", false);
     }
     if (item.Elements().Any(x => x.Name == "enclosure"))
     {
         Enclosure = new TEnclosure(item.SafeReadElement("enclosure"));
     }
 }
示例#12
0
 public TChannel(XElement channel)
     : this()
 {
     Title = channel.SafeReadElementValue <string>("title", "");
     Trace.WriteLine(string.Format("Building TChannel {0}...", Title));
     Link        = new TUri(channel.SafeReadElementValue <string>("link", ""));
     Description = channel.SafeReadElementValue <string>("description", "");
     if (channel.Elements().Any(x => x.Name == "category"))
     {
         Category = channel.SafeReadElementValue <string>("category", "");
     }
     if (channel.Elements().Any(x => x.Name == "language"))
     {
         Language = channel.SafeReadElementValue <string>("language", "");
     }
     if (channel.Elements().Any(x => x.Name == "copyright"))
     {
         Copyright = channel.SafeReadElementValue <string>("copyright", "");
     }
     LastBuildDate = channel.SafeReadElementValue <DateTime>("lastbuilddate", DateTime.MinValue);
     if (channel.Elements().Any(x => x.Name == "image"))
     {
         Picture = new TChannelImage(channel.SafeReadElement("image"));
     }
     if (channel.Elements().Any(x => x.Name == "items"))
     {
         Trace.WriteLine(string.Format("  Reading {0} item(s)", channel.Element("items").Elements().Count(x => x.Name == "item")));
         Items = new TItemCollection(channel.SafeReadElement("items"));
     }
     if (channel.Attributes().Any(x => x.Name == "encoding"))
     {
         string EncodingValue = channel.SafeReadAttribute <string>("encoding", DefaultChannelEncoding);
         if (EncodingValue != "")
         {
             ChannelEncoding = Encoding.GetEncoding(EncodingValue);
         }
     }
     if (channel.Attributes().Any(x => x.Name == "name"))
     {
         Name = channel.SafeReadAttribute <string>("name", "");
     }
     else
     {
         Name = Title;
     }
     Trace.WriteLine(string.Format("  {0}", this.ToString()));
     Trace.WriteLine("Done.");
 }
示例#13
0
 public TEnclosure(XElement enclosure)
     : this()
 {
     if (enclosure.HasAttributes)
     {
         Url = new TUri(enclosure.SafeReadAttribute <string>("url", ""));
         if (enclosure.Attributes().Any(a => a.Name == "length"))
         {
             Length = enclosure.SafeReadAttribute <int>("length", 0);
         }
         if (enclosure.Attributes().Any(a => a.Name == "mimetype"))
         {
             Mimetype = enclosure.SafeReadAttribute <string>("mimetype", "");
         }
     }
 }
示例#14
0
 public TEnclosure()
 {
     Url      = new TUri();
     Length   = 0;
     Mimetype = "";
 }