コード例 #1
0
 private bool HasUrlChanged()
 {
     try
     {
         DateTime newModifiedTime = httpRequest.GetLastModifiedTimeFor(uri, lastModified);
         Log.Info(string.Format("lastModified: {0}", lastModified.ToString()));
         Log.Info(string.Format("newModifiedTime: {0}", newModifiedTime.ToString()));
         Log.Info(string.Format("oldLastModifiedDate: {0}", oldLastModifiedDate.ToString()));
         if (lastModified == new DateTime() || newModifiedTime > lastModified)
         {
             oldLastModifiedDate = lastModified;
             lastModified        = newModifiedTime;
             Log.Info("Modifying Dates...");
             Log.Info(string.Format("lastModified: {0}", lastModified.ToString()));
             Log.Info(string.Format("newModifiedTime: {0}", newModifiedTime.ToString()));
             Log.Info(string.Format("oldLastModifiedDate: {0}", oldLastModifiedDate.ToString()));
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Error("Error accessing url: " + uri);
         Log.Error(e);
     }
     return(false);
 }
コード例 #2
0
 /// <summary>
 /// Determines whether the URL has changed.
 /// </summary>
 /// <returns>
 /// <c>true</c> if the URL has changed; otherwise, <c>false</c>.
 /// </returns>
 private bool HasUrlChanged()
 {
     try
     {
         DateTime newModifiedTime = httpRequest.GetLastModifiedTimeFor(uri, lastModified);
         if (newModifiedTime > lastModified)
         {
             lastModified = newModifiedTime;
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Error("Error accessing url: " + uri);
         Log.Error(e);
     }
     return(false);
 }
コード例 #3
0
        public void TestValidUrlThatReturnsLastModified()
        {
            DateTime lastModTime = httpWrapper.GetLastModifiedTimeFor(new Uri(@"http://www.apache.org"), DateTime.MinValue);

            Assert.IsTrue(lastModTime > DateTime.MinValue);
        }