diff --git a/MainForm.cs b/MainForm.cs index 1f6af19..18e7bc1 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -425,23 +425,32 @@ private void StartTracerouteButton_Click(object sender, EventArgs e) { ResolvedIPSelection.Visible = false; // ���� IP ѡ��� IPAddress userInputAddress; - if (IPAddress.TryParse(HostInputBox.Text, out userInputAddress)) + string userInputBoxText = HostInputBox.Text; + // ȥ�����������Ŀո� + userInputBoxText = userInputBoxText.Trim(); + + Uri uri; + if (Uri.TryCreate(HostInputBox.Text, UriKind.Absolute, out uri) && uri.Host != "") + { + // �ǺϷ��� URL + userInputBoxText = uri.Host; + } + + // �����ð�Ŷ����е�(IPv4)��ȥ��ð�ź�������� + if (userInputBoxText.IndexOf(":") != -1 && userInputBoxText.IndexOf(".") != -1) + { + userInputBoxText = userInputBoxText.Split(':')[0]; + } + if (IPAddress.TryParse(userInputBoxText, out userInputAddress)) { // �ǺϷ��� IPv4 / IPv6���ѳ��������IP�Ż��ı��� HostInputBox.Text = userInputAddress.ToString(); readyToUseIP = userInputAddress.ToString(); Title = Resources.APPTITLE + ": " + readyToUseIP; } - else - { + else { try { - Uri uri; - if (Uri.TryCreate(HostInputBox.Text, UriKind.Absolute, out uri) && uri.Host != "") - { - // �ǺϷ��� URL - HostInputBox.Text = uri.Host; - } // ��Ҫ�������� Title = Resources.APPTITLE + ": " + HostInputBox.Text; IPAddress[] resolvedAddresses = ResolveHost(HostInputBox.Text);