Example #1
0
        /// <summary>
        /// Download Server Time for TheTVDB.
        /// </summary>
        /// <returns>
        /// The current server time. Useful for updates.
        /// </returns>
        private static string DownloadServerTime()
        {
            var downloadItem = new DownloadItem
                {
                    Url = "http://cache.thetvdb.com/api/Updates.php?type=none",
                    Type = DownloadType.Html 
                };

            var html = new Html();

            html.Get(downloadItem);

            string serverTimeXml =
                Downloader.ProcessDownload(
                    string.Format(string.Format("http://cache.thetvdb.com/api/Updates.php?type=none")), 
                    DownloadType.Html, 
                    Section.Tv);

            var doc = new XmlDocument();
            doc.LoadXml(serverTimeXml);
            var timeValue = XRead.GetString(doc, "Time");
            return timeValue;
        }
Example #2
0
 /// <summary>
 /// Processes the download.
 /// </summary>
 /// <param name="downloadItem">
 /// The download item.
 /// </param>
 private static void ProcessDownload(DownloadItem downloadItem)
 {
     if (downloadItem.Type == DownloadType.Binary)
     {
         Binary.Get(downloadItem);
     }
     else if (downloadItem.Type == DownloadType.AppleBinary)
     {
         AppleBinary.Get(downloadItem);
     }
     else
     {
         var html = new Html();
         html.Get(downloadItem);
     }
 }