Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2025-02-17 22:24:58 +07:00
parent 80ff667731
commit 6dddb09223
2 changed files with 12 additions and 6 deletions

View File

@@ -30,8 +30,8 @@ namespace domain_utility
static readonly string[,] computerNameRegex = new string[,] {
{ "^[a-zA-Z]+\\d+$", "R54-630300" }, // THE01
{ "^\\d+[a-zA-Z]+\\d+$", "R54-" }, // 630300THE01
{ "^[rR]\\d*[-]\\d+[a-zA-Z]+\\d+$", "" } // R54-630300THE01
{ "^\\d{6,}[a-zA-Z]+\\d+$", "R54-" }, // 630300THE01
{ "^[rR]\\d{2,}[-]\\d{6,}[a-zA-Z]+\\d+$", "" } // R54-630300THE01
};
private static string domain_user = string.Empty;
@@ -75,7 +75,7 @@ namespace domain_utility
Console.Write("> ");
string data = Console.ReadLine();
if (string.IsNullOrWhiteSpace(data))
InputData(message, callback, withClear, withChecks);
return InputData(message, callback, withClear, withChecks);
data = data.Trim();
Console.WriteLine();
if (withChecks)
@@ -200,9 +200,9 @@ namespace domain_utility
case IPStatus.Success:
{
if (pingReply.RoundtripTime < 1)
returnMessage = string.Format("Ответ от {0}: число байт={1} время<1ms TTL={2}", pingReply.Address, pingReply.Buffer.Length, pingReply.Options.Ttl);
returnMessage = string.Format("Ответ от {0}: число байт={1} время<1мс TTL={2}", pingReply.Address, pingReply.Buffer.Length, pingReply.Options.Ttl);
else
returnMessage = string.Format("Ответ от {0}: число байт={1} время={2}ms TTL={3}", pingReply.Address, pingReply.Buffer.Length, pingReply.RoundtripTime, pingReply.Options.Ttl);
returnMessage = string.Format("Ответ от {0}: число байт={1} время={2}мс TTL={3}", pingReply.Address, pingReply.Buffer.Length, pingReply.RoundtripTime, pingReply.Options.Ttl);
break;
}
case IPStatus.TimedOut:
@@ -237,6 +237,7 @@ namespace domain_utility
string remote = InputData("\nВведите IP адрес или имя компьютера (пр. 10.234.16.129, 'IT04', '630300IT04', 'R54-630300IT04'):",
StartPing);
Console.WriteLine("Нажмите Ctrl + C чтобы остановить\n");
string correctName = CheckComputerName(remote);
if (correctName != string.Empty)
{
@@ -244,7 +245,7 @@ namespace domain_utility
{
IPAddress ip = Dns.GetHostEntry(correctName).AddressList.First(addr => addr.AddressFamily == AddressFamily.InterNetwork);
remote = ip.ToString();
Console.WriteLine("Обмен пакетами с {0} [{1}] с 32 байтами данных:", correctName, remote);
Console.WriteLine("Обмен пакетами с {0}.main.russianpost.ru [{1}] с 32 байтами данных:", correctName, remote);
}
catch (Exception)
{