public float getLoadTime(string URL) { float loadTime = 0; if (Nurl.isURL(URL)) { var timeBefore = DateTime.Now; getContent(URL); var timeAfter = DateTime.Now; loadTime = (timeAfter - timeBefore).Milliseconds; } return(loadTime); }
public string getContent(string URL) { string content = ""; if (Nurl.isURL(URL)) { var webClient = new System.Net.WebClient(); content = webClient.DownloadString(URL); //Suppression du retour à la ligne '\n' content = content.Remove(content.Length - 1); } return(content); }
public void testIsURL(string URL, Boolean expected) { var result = Nurl.isURL(URL); Assert.AreEqual(result, expected, "Erreur testIsURL"); }