public bool CheckNewPublicIPAdress() { string auxPublicIP = IPUtils.GetPublicIP(); if ((auxPublicIP != PublicIP) || (String.IsNullOrEmpty(PublicIP) && String.IsNullOrEmpty(LocalIP))) { PublicIP = auxPublicIP; LocalIP = IPUtils.GetLocalIP(); email.Subject = "[WhatsMyIP] Se cambió la IP pública a " + PublicIP; email.Message = "<b>IP pública:</b> " + PublicIP + "\n <br />" + "<b>IP local:</b> " + LocalIP; email.Message += "\n <br /> \n <br /> <b><u>NETSTAT</u></b> \n <br />" + IPUtils.GetNetStat(); email.Message += "\n <br /> \n <br /> <b><u>GEOLOCALIZACION</u></b> \n <br />" + IPUtils.GetGeoLocationWithIP(this.PublicIP); MailUtils.SendEmail(email); return(true); } return(false); }
public void GetGeoLocationIPTest() { string rdo = IPUtils.GetGeoLocationWithIP(IPUtils.GetPublicIP()); Assert.IsFalse(String.IsNullOrEmpty(rdo)); }
public void GetGlobalIPTest() { Regex ip = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"); Assert.IsFalse(String.IsNullOrEmpty(ip.Matches(IPUtils.GetPublicIP())[0].ToString())); }