Exemplo n.º 1
0
 /// <summary>
 /// Validates PubDate
 /// </summary>
 /// <param name="version"></param>
 private void ValidatePubDate(RssVersion version)
 {
     if (this.PubDate == null)
     {
         return;
     }
     if (version == RssVersion.RSS_0_91 ||
         version == RssVersion.RSS_0_92 ||
         version == RssVersion.RSS_2_0_1)
     {
         try {
             RssDateTime rdt = new RssDateTime(this.PubDate);
         }
         catch (Exception x) {
             string msg = string.Format(Rss.RSS_ERRORMESSAGE_VALIDATION_FAILED, RSS_ELEMENT_ITEM, RSS_ELEMENT_PUBDATE);
             throw new SyndicationValidationException(msg, x);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Convert a datetime and offset to a string.
        /// </summary>
        /// <param name="dateTime"></param>
        /// <param name="offset"></param>
        /// <returns></returns>
        public static string ToString(DateTime dateTime, TimeSpan offset)
        {
            RssDateTime rdt = new RssDateTime(dateTime, offset);

            return(rdt.ToString());
        }