static void Main(string[] args) { string url; CDicionario CD = new CDicionario(); HashtableDicionario HS = new HashtableDicionario(); Console.Write("\n Informe a URL do site que deseja saber o IP: "); url = Console.ReadLine(); HS.criacaoHash(url); Console.Title = "URLs / IPs"; Console.Clear(); Console.WriteLine("Obrigada por utilizar nosso programa!"); Console.ReadKey(); }
public void criacaoHash(string url) { CDicionario CD = new CDicionario(); Hashtable URL = new Hashtable() { { "www.google.com", "173.194.119.20" }, { "www.amazon.com", "176.32.103.205" }, { "www.pucminas.br", "200.229.43.1" }, { "research.microsoft.com", "131.107.65.14" }, { "www.gmail.com", "216.58.222.5" }, { "www.facebook.com", "67.171.230.5" }, { "www.youtube.com", "173.194.118.85" }, { "www.whitehouse.gov", "23.77.40.38" }, { "www.capes.gov.br", "200.130.18.222" }, { "www.answers.com", "67.196.156.65" }, { "www.yahoo.com", "200.152.175.146" }, { "www.uol.com.br", "200.221.2.45" }, { "www.microsoft.com", "23.76.203.113" }, { "www.hotmail.com", "65.65.65.188" }, { "www.twitter.com", "199.16.158.104" }, { "www.cplusplus.com", "167.114.170.15" }, { "www.brasil.gov.br", "161.148.175.40" }, { "www.nyt.com", "170.149.159.130" }, { "www.wikipedia.com", "208.80.154.224" }, { "www.apple.com", "104.88.124.67" }, { "www.algartech.com.br", "191.96.5.63" }, { "www.sotreq.com.br", "174.132.119.180" }, { "www.globo.com", "186.192.82.163" }, { "www.santander.com.br", "23.76.245.229" }, { "www.linx.com.br", "186.202.179.135" } }; foreach (DictionaryEntry DE in URL) { CD.Adiciona(DE.Key, DE.Value); } if (URL.ContainsKey(url)) { Console.WriteLine(" URL: " + url + "\t IP: " + CD.RecebeValor(url)); } else { Console.Write(" \n ERRO! URL não cadastrada"); } Console.ReadKey(); }