Update Program.cs

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2025-02-27 19:28:51 +07:00
parent c5f59da80f
commit 57c1fd0095

View File

@@ -19,16 +19,16 @@ namespace domain_utility
{
internal class Program
{
static readonly string regularDateTime = @"(\d+[.]\d+[.]\d+[ ]\d+[:]\d+[:]\d+)";
private static readonly string regularDateTime = @"(\d+[.]\d+[.]\d+[ ]\d+[:]\d+[:]\d+)";
static readonly string[,] stringsToFind = new string[,] {
private static readonly string[,] stringsToFind = new string[,] {
{ "Учетная запись активна", @"(Yes|No)", "Учетная запись работает: " },
{ "Последний пароль задан", regularDateTime, "Когда был сменен пароль: " },
{ "Действие пароля завершается", regularDateTime, "Когда нужно менять пароль (крайний срок): "},
{ "Членство в глобальных группах", @"([*].+)", "Член групп:\t" }
};
static readonly string[,] computerNameRegex = new string[,] {
private static readonly string[,] computerNameRegex = new string[,] {
{ "^[a-zA-Z]+\\d+$", "R54-630300" }, // THE01
{ "^\\d{6,}[a-zA-Z]+\\d+$", "R54-" }, // 630300THE01
{ "^[rR]\\d{2,}[-]\\d{6,}[a-zA-Z]+\\d+$", "" } // R54-630300THE01
@@ -37,7 +37,6 @@ namespace domain_utility
private static string domain_user = string.Empty;
private static string domain_password = string.Empty;
//private static volatile bool _click_cancel = false;
private static bool _click_cancel = false;
private static bool IsStringContainIp(string ip)
@@ -53,22 +52,8 @@ namespace domain_utility
return string.Empty;
}
//private static void InputCancelClick(object sender, ConsoleCancelEventArgs e)
//{
// //e.Cancel = true;
// _click_cancel = true;
// //Menu();
//}
private static string InputData(string message, Action callback, bool withClear = true, bool withChecks = true)
{
//Console.CancelKeyPress += InputCancelClick;
//if (_click_cancel)
//{
// Console.CancelKeyPress -= InputCancelClick;
// _click_cancel = false;
// Menu();
//}
if (withClear)
Console.Clear();
Console.WriteLine(message);
@@ -161,7 +146,7 @@ namespace domain_utility
}
}
public static void ResetAdminPassword()
private static void ResetAdminPassword()
{
string machineNameAndUser = WindowsIdentity.GetCurrent().Name.ToString();
string machineName = machineNameAndUser.Substring(0, machineNameAndUser.IndexOf('\\'));
@@ -561,8 +546,6 @@ namespace domain_utility
private class JsonFile
{
//public string username = ""; // как получать и где хранить? задавать в файле?
//public string password = ""; // где хранить и хранить ли?
public int sleep_time = 0;
public int restart_time = 0;
public string message = "";
@@ -602,7 +585,6 @@ namespace domain_utility
static void Main(string[] args)
{
//Console.Title = typeof(Program).Assembly.GetName().Name;
Console.Title = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyTitleAttribute>().Title;
if (args[0] == "reboot")
{