Commit 17723d0c57625f96b018f7cb4d8c48dda43ceb6c
1 parent
b28aff5e
v1.19.2.0
Showing
10 changed files
with
51 additions
and
50 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Menu.cs
| @@ -338,11 +338,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | @@ -338,11 +338,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | ||
| 338 | /// </summary> | 338 | /// </summary> |
| 339 | /// <param name="forcedselectionkeylist"></param> | 339 | /// <param name="forcedselectionkeylist"></param> |
| 340 | /// <returns></returns> | 340 | /// <returns></returns> |
| 341 | - public Selection Select(string forcedselectionkeylist=null) | 341 | + public Selection Select(string forcedselectionkeylist=null, bool forcedcommandmode=false) |
| 342 | { | 342 | { |
| 343 | string selectionliststr; | 343 | string selectionliststr; |
| 344 | var result = new Selection(); | 344 | var result = new Selection(); |
| 345 | - if (Menu.IsCommandMode()) | 345 | + if (Menu.IsCommandMode() || forcedcommandmode) |
| 346 | { | 346 | { |
| 347 | selectionliststr = forcedselectionkeylist??"EX"; | 347 | selectionliststr = forcedselectionkeylist??"EX"; |
| 348 | } | 348 | } |
| @@ -360,7 +360,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | @@ -360,7 +360,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | ||
| 360 | selectionliststr = ColorConsole.ReadLine().ToUpper(); | 360 | selectionliststr = ColorConsole.ReadLine().ToUpper(); |
| 361 | } | 361 | } |
| 362 | } | 362 | } |
| 363 | - if (selectionliststr == "EX") | 363 | + if (selectionliststr.ToUpper() == "EX") |
| 364 | { | 364 | { |
| 365 | result.Result = SelectionResult.Exit; | 365 | result.Result = SelectionResult.Exit; |
| 366 | result.SelectedKeyList = null; | 366 | result.SelectedKeyList = null; |
Vrh.Log4Pro.MaintenanceConsole/Manager - InstallManager.cs
| @@ -60,7 +60,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.InstallManagerNS | @@ -60,7 +60,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.InstallManagerNS | ||
| 60 | var selectedos = GetOsCode();if (selectedos == null) { return o; } | 60 | var selectedos = GetOsCode();if (selectedos == null) { return o; } |
| 61 | 61 | ||
| 62 | string featurename = ColorConsole.ReadLine($"Enter Windows feature name!", ConsoleColor.Green,required:true); | 62 | string featurename = ColorConsole.ReadLine($"Enter Windows feature name!", ConsoleColor.Green,required:true); |
| 63 | - if (featurename.ToLower() == "ex") { return o; } | 63 | + if (featurename.ToUpper() == "EX") { return o; } |
| 64 | 64 | ||
| 65 | foreach (var wfg in config.WindowsFeatureGroups.Where(x => selectedos == null || x.OS == selectedos)) | 65 | foreach (var wfg in config.WindowsFeatureGroups.Where(x => selectedos == null || x.OS == selectedos)) |
| 66 | { | 66 | { |
| @@ -119,7 +119,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.InstallManagerNS | @@ -119,7 +119,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.InstallManagerNS | ||
| 119 | : ""; | 119 | : ""; |
| 120 | var oslist = Enum.GetNames(typeof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values)).ToList(); | 120 | var oslist = Enum.GetNames(typeof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values)).ToList(); |
| 121 | string answer = ColorConsole.ReadLine($"Enter os code (friendly name is: '{osfrn}')!", ConsoleColor.Green, validitylist: oslist, defaultvalue: defaultvalue.ToString(), required: true); | 121 | string answer = ColorConsole.ReadLine($"Enter os code (friendly name is: '{osfrn}')!", ConsoleColor.Green, validitylist: oslist, defaultvalue: defaultvalue.ToString(), required: true); |
| 122 | - if (answer.ToLower() == "ex") { return null; } | 122 | + if (answer.ToUpper() == "EX") { return null; } |
| 123 | InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values? selectedos = null; | 123 | InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values? selectedos = null; |
| 124 | selectedos = (InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values)Enum | 124 | selectedos = (InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values)Enum |
| 125 | .Parse(typeof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values), answer); | 125 | .Parse(typeof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values), answer); |
Vrh.Log4Pro.MaintenanceConsole/Manager - MSMQManager.cs
| @@ -212,7 +212,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -212,7 +212,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 212 | while (true) | 212 | while (true) |
| 213 | { | 213 | { |
| 214 | sn = ColorConsole.ReadLine("Enter server ip/name to get queue info from (enter . for localhost)", defaultvalue: sndefault); | 214 | sn = ColorConsole.ReadLine("Enter server ip/name to get queue info from (enter . for localhost)", defaultvalue: sndefault); |
| 215 | - if (sn.ToLower() == "ex") { return o; } | 215 | + if (sn.ToUpper() == "EX") { return o; } |
| 216 | sndefault = sn; | 216 | sndefault = sn; |
| 217 | 217 | ||
| 218 | List<System.Messaging.MessageQueue> queuearray = new List<System.Messaging.MessageQueue>(); | 218 | List<System.Messaging.MessageQueue> queuearray = new List<System.Messaging.MessageQueue>(); |
Vrh.Log4Pro.MaintenanceConsole/Manager - MaintenanceToolManager.cs
| @@ -86,9 +86,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | @@ -86,9 +86,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | ||
| 86 | while(true) | 86 | while(true) |
| 87 | { | 87 | { |
| 88 | var regexstr = ColorConsole.ReadLine($"Enter REGEX to test with:", ConsoleColor.Yellow); | 88 | var regexstr = ColorConsole.ReadLine($"Enter REGEX to test with:", ConsoleColor.Yellow); |
| 89 | - if (regexstr == "EX") { break; } | 89 | + if (regexstr.ToUpper() == "EX") { break; } |
| 90 | var teststr = ColorConsole.ReadLine($"Enter STRING to test:", ConsoleColor.Yellow); | 90 | var teststr = ColorConsole.ReadLine($"Enter STRING to test:", ConsoleColor.Yellow); |
| 91 | - if (teststr == "EX") { break; } | 91 | + if (teststr.ToUpper() == "EX") { break; } |
| 92 | 92 | ||
| 93 | var rgx = new Regex(regexstr, RegexOptions.None); | 93 | var rgx = new Regex(regexstr, RegexOptions.None); |
| 94 | var regexmatch = rgx.Match(teststr); | 94 | var regexmatch = rgx.Match(teststr); |
| @@ -136,7 +136,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | @@ -136,7 +136,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | var command = firstrun ? "STARTANDSHOW *" : ColorConsole.ReadLine(); | 138 | var command = firstrun ? "STARTANDSHOW *" : ColorConsole.ReadLine(); |
| 139 | - if (command == "EX") { break; } | 139 | + if (command.ToUpper() == "EX") { break; } |
| 140 | if (command == "") { continue; } | 140 | if (command == "") { continue; } |
| 141 | var cmdarray = command.Split(' '); | 141 | var cmdarray = command.Split(' '); |
| 142 | if (cmdarray.Length!=2) { ColorConsole.WriteLine($"Incorrect answer!", ConsoleColor.Red); continue; } | 142 | if (cmdarray.Length!=2) { ColorConsole.WriteLine($"Incorrect answer!", ConsoleColor.Red); continue; } |
| @@ -387,7 +387,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | @@ -387,7 +387,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | ||
| 387 | if (success) { selectedcommand.Execute(); }//végrehajtja a parancsot } | 387 | if (success) { selectedcommand.Execute(); }//végrehajtja a parancsot } |
| 388 | string successmsg = success ? "succeeded" : "failed"; | 388 | string successmsg = success ? "succeeded" : "failed"; |
| 389 | string answer = ColorConsole.ReadLine($"{nameof(AseConfig)} command execution {successmsg} on {currentip}!\nEnter EX to exit from execution loop, anything else to continue!", success?ConsoleColor.Yellow: ConsoleColor.Red); | 389 | string answer = ColorConsole.ReadLine($"{nameof(AseConfig)} command execution {successmsg} on {currentip}!\nEnter EX to exit from execution loop, anything else to continue!", success?ConsoleColor.Yellow: ConsoleColor.Red); |
| 390 | - if (answer.ToLower() == "ex") break; | 390 | + if (answer.ToUpper() == "EX") break; |
| 391 | } | 391 | } |
| 392 | return o; | 392 | return o; |
| 393 | } | 393 | } |
| @@ -405,7 +405,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | @@ -405,7 +405,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | ||
| 405 | ColorConsole.WriteLine(onelineinfo.Item3, ConsoleColor.Gray); | 405 | ColorConsole.WriteLine(onelineinfo.Item3, ConsoleColor.Gray); |
| 406 | } | 406 | } |
| 407 | var answer = ColorConsole.ReadLine($"Select command key", ConsoleColor.Gray, bracket: "[]",validitylist: aseconfigcommandList.Select(c => c.Key).ToList()); | 407 | var answer = ColorConsole.ReadLine($"Select command key", ConsoleColor.Gray, bracket: "[]",validitylist: aseconfigcommandList.Select(c => c.Key).ToList()); |
| 408 | - if (answer.ToLower() == "ex") return null; | 408 | + if (answer.ToUpper() == "EX") return null; |
| 409 | return answer; | 409 | return answer; |
| 410 | } | 410 | } |
| 411 | private class ASEConfigCommand | 411 | private class ASEConfigCommand |
| @@ -599,8 +599,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | @@ -599,8 +599,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS | ||
| 599 | ColorConsole.WriteLine(prompttext,ConsoleColor.Yellow); | 599 | ColorConsole.WriteLine(prompttext,ConsoleColor.Yellow); |
| 600 | ColorConsole.WriteLine($"Enter NONE (or nothing) for no value!", ConsoleColor.Gray); | 600 | ColorConsole.WriteLine($"Enter NONE (or nothing) for no value!", ConsoleColor.Gray); |
| 601 | value = ColorConsole.ReadLine(); | 601 | value = ColorConsole.ReadLine(); |
| 602 | - value = value.ToLower() == "ex" ? null | ||
| 603 | - : value.ToLower() == "none" ? "<None>" | 602 | + value = value.ToUpper() == "EX" ? null |
| 603 | + : value.ToUpper() == "NONE" ? "<None>" | ||
| 604 | : value == "" ? "<None>" | 604 | : value == "" ? "<None>" |
| 605 | : value; | 605 | : value; |
| 606 | return value; | 606 | return value; |
Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs
| @@ -257,7 +257,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS | @@ -257,7 +257,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS | ||
| 257 | } | 257 | } |
| 258 | var scriptkey = ColorConsole.ReadLine("Select the script! [empty]=next DB, [*]=all, [EX]=exit.", ConsoleColor.Yellow, prefix:" ", suffix: " --> ", validitylist: vlist); | 258 | var scriptkey = ColorConsole.ReadLine("Select the script! [empty]=next DB, [*]=all, [EX]=exit.", ConsoleColor.Yellow, prefix:" ", suffix: " --> ", validitylist: vlist); |
| 259 | if (string.IsNullOrWhiteSpace(scriptkey)) { continue; } | 259 | if (string.IsNullOrWhiteSpace(scriptkey)) { continue; } |
| 260 | - if (scriptkey.ToLower()=="ex") { return o; } | 260 | + if (scriptkey.ToUpper() == "EX") { return o; } |
| 261 | SQLDataBase.SQLScript ss = sqld.Xml_SQLScriptList.FirstOrDefault(s=>s.Key==scriptkey); | 261 | SQLDataBase.SQLScript ss = sqld.Xml_SQLScriptList.FirstOrDefault(s=>s.Key==scriptkey); |
| 262 | if (!Tools.ResolveArguments(ss.ArgumentParameters, ss.ScriptText,out string ssScriptText)) { return o; } | 262 | if (!Tools.ResolveArguments(ss.ArgumentParameters, ss.ScriptText,out string ssScriptText)) { return o; } |
| 263 | ColorConsole.WriteLine(ssScriptText); | 263 | ColorConsole.WriteLine(ssScriptText); |
| @@ -296,7 +296,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS | @@ -296,7 +296,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS | ||
| 296 | ColorConsole.WriteLine(prefix: " ", text: "TruncateOnly", bracket: "[]", suffix: $": does not compact the data, but removes free space from the DB. Use togethere with FreeSpacePercent.", f: ConsoleColor.Yellow); | 296 | ColorConsole.WriteLine(prefix: " ", text: "TruncateOnly", bracket: "[]", suffix: $": does not compact the data, but removes free space from the DB. Use togethere with FreeSpacePercent.", f: ConsoleColor.Yellow); |
| 297 | ColorConsole.WriteLine(prefix: " ", text: "FreeSpacePercent", bracket: "[]", suffix: $": an integer number between 0-100,default=10; indicates the percentage of free space in the shrinked DB.", f: ConsoleColor.Yellow); | 297 | ColorConsole.WriteLine(prefix: " ", text: "FreeSpacePercent", bracket: "[]", suffix: $": an integer number between 0-100,default=10; indicates the percentage of free space in the shrinked DB.", f: ConsoleColor.Yellow); |
| 298 | var shrinkoptions = ColorConsole.ReadLine($"EX=exit.", ConsoleColor.Yellow, suffix: " --> "); | 298 | var shrinkoptions = ColorConsole.ReadLine($"EX=exit.", ConsoleColor.Yellow, suffix: " --> "); |
| 299 | - if (shrinkoptions == "EX") { continue; } | 299 | + if (shrinkoptions.ToUpper() == "EX") { continue; } |
| 300 | else if (string.IsNullOrWhiteSpace(shrinkoptions)) { shrinkoptions = "Default,10"; } | 300 | else if (string.IsNullOrWhiteSpace(shrinkoptions)) { shrinkoptions = "Default,10"; } |
| 301 | string option, fsp = null; | 301 | string option, fsp = null; |
| 302 | int fspint = 10; | 302 | int fspint = 10; |
| @@ -334,13 +334,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS | @@ -334,13 +334,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS | ||
| 334 | try | 334 | try |
| 335 | { | 335 | { |
| 336 | var restoredbname = ColorConsole.ReadLine($"Enter the name of the DB to copy '{sqld.DBName}' to. Empty={sqld.DBName}. EX=exit.", ConsoleColor.Yellow, suffix: " --> "); | 336 | var restoredbname = ColorConsole.ReadLine($"Enter the name of the DB to copy '{sqld.DBName}' to. Empty={sqld.DBName}. EX=exit.", ConsoleColor.Yellow, suffix: " --> "); |
| 337 | - if (restoredbname == "EX") { continue; } | 337 | + if (restoredbname.ToUpper() == "EX") { continue; } |
| 338 | else if (string.IsNullOrWhiteSpace(restoredbname)) { restoredbname = sqld.DBName; } | 338 | else if (string.IsNullOrWhiteSpace(restoredbname)) { restoredbname = sqld.DBName; } |
| 339 | ColorConsole.WriteLine("Enter the path for the DB physical files.", ConsoleColor.Yellow); | 339 | ColorConsole.WriteLine("Enter the path for the DB physical files.", ConsoleColor.Yellow); |
| 340 | ColorConsole.WriteLine(sqld.PhysicalFilesDirectoryPath, ConsoleColor.Yellow, prefix: $" Empty=current location of source DB: ", bracket: "[]"); | 340 | ColorConsole.WriteLine(sqld.PhysicalFilesDirectoryPath, ConsoleColor.Yellow, prefix: $" Empty=current location of source DB: ", bracket: "[]"); |
| 341 | ColorConsole.WriteLine(SQLDataBaseManagerCore.GetServerDefaultPhysicalDATFileLocation(sqld.SQLCS), ConsoleColor.Yellow,prefix: $" DEFAULT= sql server default location.",bracket:"[]"); | 341 | ColorConsole.WriteLine(SQLDataBaseManagerCore.GetServerDefaultPhysicalDATFileLocation(sqld.SQLCS), ConsoleColor.Yellow,prefix: $" DEFAULT= sql server default location.",bracket:"[]"); |
| 342 | var targetdirectory = ColorConsole.ReadLine($"Enter the target path.EX=exit.", ConsoleColor.Yellow, suffix: " --> "); | 342 | var targetdirectory = ColorConsole.ReadLine($"Enter the target path.EX=exit.", ConsoleColor.Yellow, suffix: " --> "); |
| 343 | - if (targetdirectory == "EX") { continue; } | 343 | + if (targetdirectory.ToUpper() == "EX") { continue; } |
| 344 | else if (targetdirectory == "DEFAULT") { targetdirectory = null; ; } | 344 | else if (targetdirectory == "DEFAULT") { targetdirectory = null; ; } |
| 345 | else if (string.IsNullOrWhiteSpace(targetdirectory)) { targetdirectory = sqld.PhysicalFilesDirectoryPath; } | 345 | else if (string.IsNullOrWhiteSpace(targetdirectory)) { targetdirectory = sqld.PhysicalFilesDirectoryPath; } |
| 346 | 346 |
Vrh.Log4Pro.MaintenanceConsole/Manager - UserManager.cs
| @@ -80,9 +80,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -80,9 +80,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
| 80 | var initactionblocknamelist = string.Join(",", config.InitActionBlockList.Select(iab => iab.Name).ToArray()); | 80 | var initactionblocknamelist = string.Join(",", config.InitActionBlockList.Select(iab => iab.Name).ToArray()); |
| 81 | ColorConsole.WriteLine($"Select one init action block from this list: {initactionblocknamelist}", ConsoleColor.Yellow); | 81 | ColorConsole.WriteLine($"Select one init action block from this list: {initactionblocknamelist}", ConsoleColor.Yellow); |
| 82 | var iabname = ColorConsole.ReadLine($"Enter init action block name:", ConsoleColor.Yellow).ToLower(); | 82 | var iabname = ColorConsole.ReadLine($"Enter init action block name:", ConsoleColor.Yellow).ToLower(); |
| 83 | - if (iabname == "EX") { return null; } | 83 | + if (iabname.ToUpper() == "EX") { return null; } |
| 84 | var stepbystep = ColorConsole.ReadLine($"Do You want to execute step-by-step (true/false/yes/no/?:", ConsoleColor.Yellow).ToLower().Replace("yes","true")==bool.TrueString.ToLower(); | 84 | var stepbystep = ColorConsole.ReadLine($"Do You want to execute step-by-step (true/false/yes/no/?:", ConsoleColor.Yellow).ToLower().Replace("yes","true")==bool.TrueString.ToLower(); |
| 85 | - if (iabname == "EX") { return null; } | 85 | + if (iabname.ToUpper() == "EX") { return null; } |
| 86 | try | 86 | try |
| 87 | { | 87 | { |
| 88 | var iab = config.InitActionBlockList.FirstOrDefault(_iab => _iab.Name.ToLower() == iabname); | 88 | var iab = config.InitActionBlockList.FirstOrDefault(_iab => _iab.Name.ToLower() == iabname); |
| @@ -92,7 +92,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -92,7 +92,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
| 92 | if (stepbystep) | 92 | if (stepbystep) |
| 93 | { | 93 | { |
| 94 | ColorConsole.WriteLine($"Action:{cr.Type}, role names: {cr.Roles}.", ConsoleColor.Yellow); | 94 | ColorConsole.WriteLine($"Action:{cr.Type}, role names: {cr.Roles}.", ConsoleColor.Yellow); |
| 95 | - var sel = ColorConsole.ReadLine($"Press enter to continue.", ConsoleColor.Gray); if (sel.ToLower() == "ex") return o; | 95 | + var sel = ColorConsole.ReadLine($"Press enter to continue.", ConsoleColor.Gray); if (sel.ToUpper() == "EX") return o; |
| 96 | } | 96 | } |
| 97 | foreach (var rn in cr.RoleArray) { try { MembershipTools.Roles.Create(rn); } catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); }; } | 97 | foreach (var rn in cr.RoleArray) { try { MembershipTools.Roles.Create(rn); } catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); }; } |
| 98 | } | 98 | } |
| @@ -101,7 +101,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -101,7 +101,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
| 101 | if (stepbystep) | 101 | if (stepbystep) |
| 102 | { | 102 | { |
| 103 | ColorConsole.WriteLine($"Action:{cr.Type}, rolegroup name: {cr.Name}, roles: {cr.Roles}.", ConsoleColor.Yellow); | 103 | ColorConsole.WriteLine($"Action:{cr.Type}, rolegroup name: {cr.Name}, roles: {cr.Roles}.", ConsoleColor.Yellow); |
| 104 | - var sel = ColorConsole.ReadLine($"Press enter to continue.", ConsoleColor.Gray); if (sel.ToLower() == "ex") return o; | 104 | + var sel = ColorConsole.ReadLine($"Press enter to continue.", ConsoleColor.Gray); if (sel.ToUpper() == "EX") return o; |
| 105 | } | 105 | } |
| 106 | try | 106 | try |
| 107 | { | 107 | { |
| @@ -116,7 +116,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -116,7 +116,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
| 116 | { | 116 | { |
| 117 | var crtext = cr.Superuser ? $"superuser" : $"rolegroups: {cr.RoleGroups}, roles: {cr.Roles}"; | 117 | var crtext = cr.Superuser ? $"superuser" : $"rolegroups: {cr.RoleGroups}, roles: {cr.Roles}"; |
| 118 | ColorConsole.WriteLine($"Action:{cr.Type}, username: {cr.Name}[{cr.Password}], {crtext}.", ConsoleColor.Yellow); | 118 | ColorConsole.WriteLine($"Action:{cr.Type}, username: {cr.Name}[{cr.Password}], {crtext}.", ConsoleColor.Yellow); |
| 119 | - var sel = ColorConsole.ReadLine($"Press enter to continue.", ConsoleColor.Gray); if (sel.ToLower() == "ex") return o; | 119 | + var sel = ColorConsole.ReadLine($"Press enter to continue.", ConsoleColor.Gray); if (sel.ToUpper() == "EX") return o; |
| 120 | } | 120 | } |
| 121 | try | 121 | try |
| 122 | { | 122 | { |
| @@ -135,9 +135,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -135,9 +135,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
| 135 | { | 135 | { |
| 136 | var config = (parameter as Menu.ExecutorParameter).GetConfig<Log4ProUserManagerXmlProcessor>(); | 136 | var config = (parameter as Menu.ExecutorParameter).GetConfig<Log4ProUserManagerXmlProcessor>(); |
| 137 | var suname = ColorConsole.ReadLine($"Enter Superuser name:", ConsoleColor.Yellow); | 137 | var suname = ColorConsole.ReadLine($"Enter Superuser name:", ConsoleColor.Yellow); |
| 138 | - if (suname == "EX") { return null; } | 138 | + if (suname.ToUpper() == "EX") { return null; } |
| 139 | var supsw = ColorConsole.ReadLine($"Enter Superuser password:", ConsoleColor.Yellow); | 139 | var supsw = ColorConsole.ReadLine($"Enter Superuser password:", ConsoleColor.Yellow); |
| 140 | - if (supsw == "EX") { return null; } | 140 | + if (supsw.ToUpper() == "EX") { return null; } |
| 141 | 141 | ||
| 142 | try | 142 | try |
| 143 | { | 143 | { |
| @@ -166,7 +166,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | @@ -166,7 +166,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.UserManagerNS | ||
| 166 | { | 166 | { |
| 167 | var config = (parameter as Menu.ExecutorParameter).GetConfig<Log4ProUserManagerXmlProcessor>(); | 167 | var config = (parameter as Menu.ExecutorParameter).GetConfig<Log4ProUserManagerXmlProcessor>(); |
| 168 | var uname = ColorConsole.ReadLine($"Enter username:", ConsoleColor.Yellow); | 168 | var uname = ColorConsole.ReadLine($"Enter username:", ConsoleColor.Yellow); |
| 169 | - if (uname == "EX") { return null; } | 169 | + if (uname.ToUpper() == "EX") { return null; } |
| 170 | 170 | ||
| 171 | try | 171 | try |
| 172 | { | 172 | { |
Vrh.Log4Pro.MaintenanceConsole/Manager - WebApplicationManager.cs
| @@ -119,7 +119,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -119,7 +119,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 119 | urlname = ColorConsole.ReadLine(); | 119 | urlname = ColorConsole.ReadLine(); |
| 120 | } | 120 | } |
| 121 | else { urlname = "*"; } | 121 | else { urlname = "*"; } |
| 122 | - if (urlname.ToLower() == "ex") return o; | 122 | + if (urlname.ToUpper() == "EX") return o; |
| 123 | if (string.IsNullOrWhiteSpace(urlname)) goto getsendurlnameurlinputcycle; | 123 | if (string.IsNullOrWhiteSpace(urlname)) goto getsendurlnameurlinputcycle; |
| 124 | 124 | ||
| 125 | string urltext; | 125 | string urltext; |
| @@ -132,12 +132,12 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -132,12 +132,12 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 132 | ColorConsole.WriteLine("Enter url to send:", ConsoleColor.Yellow); | 132 | ColorConsole.WriteLine("Enter url to send:", ConsoleColor.Yellow); |
| 133 | ColorConsole.WriteLine("Sample (Enter 'Sample' to use this):", ConsoleColor.Gray, suffix: TESTURL); | 133 | ColorConsole.WriteLine("Sample (Enter 'Sample' to use this):", ConsoleColor.Gray, suffix: TESTURL); |
| 134 | urltext = ColorConsole.ReadLine(); | 134 | urltext = ColorConsole.ReadLine(); |
| 135 | - if (urltext.ToLower() == "ex") return o; | 135 | + if (urltext.ToUpper() == "EX") return o; |
| 136 | if (urltext.ToLower() == "sample") urltext = TESTURL; | 136 | if (urltext.ToLower() == "sample") urltext = TESTURL; |
| 137 | if (string.IsNullOrWhiteSpace(urltext)) goto getsendurlnameurlinputcycle; | 137 | if (string.IsNullOrWhiteSpace(urltext)) goto getsendurlnameurlinputcycle; |
| 138 | ColorConsole.WriteLine("Enter request type (GET/POST):", ConsoleColor.Yellow); | 138 | ColorConsole.WriteLine("Enter request type (GET/POST):", ConsoleColor.Yellow); |
| 139 | string gpstr = ColorConsole.ReadLine(); | 139 | string gpstr = ColorConsole.ReadLine(); |
| 140 | - if (gpstr.ToLower() == "ex") return o; | 140 | + if (gpstr.ToUpper() == "EX") return o; |
| 141 | gp = HttpTools.RequestType.GET; | 141 | gp = HttpTools.RequestType.GET; |
| 142 | if (string.IsNullOrWhiteSpace(gpstr)) goto getsendurlnameurlinputcycle; | 142 | if (string.IsNullOrWhiteSpace(gpstr)) goto getsendurlnameurlinputcycle; |
| 143 | else if (gpstr.ToUpper() == nameof(HttpTools.RequestType.GET)) { gp = HttpTools.RequestType.GET; } | 143 | else if (gpstr.ToUpper() == nameof(HttpTools.RequestType.GET)) { gp = HttpTools.RequestType.GET; } |
| @@ -145,7 +145,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -145,7 +145,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 145 | 145 | ||
| 146 | ColorConsole.WriteLine("Enter timeout (0 for default):", ConsoleColor.Yellow); | 146 | ColorConsole.WriteLine("Enter timeout (0 for default):", ConsoleColor.Yellow); |
| 147 | string tostring = ColorConsole.ReadLine(); | 147 | string tostring = ColorConsole.ReadLine(); |
| 148 | - if (tostring.ToLower() == "ex") return o; | 148 | + if (tostring.ToUpper() == "EX") return o; |
| 149 | to = 0; | 149 | to = 0; |
| 150 | if (string.IsNullOrWhiteSpace(tostring)) goto getsendurlnameurlinputcycle; | 150 | if (string.IsNullOrWhiteSpace(tostring)) goto getsendurlnameurlinputcycle; |
| 151 | else if (!int.TryParse(tostring,out to)) { } | 151 | else if (!int.TryParse(tostring,out to)) { } |
| @@ -464,7 +464,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -464,7 +464,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 464 | { | 464 | { |
| 465 | var wa = p.Parameters as WebApplication; | 465 | var wa = p.Parameters as WebApplication; |
| 466 | GetImpersonateInfo(wa, out string username, out string password, out string impersonate); | 466 | GetImpersonateInfo(wa, out string username, out string password, out string impersonate); |
| 467 | - if (username == "EX" || password == "EX" || impersonate == "EX") { return o; } | 467 | + if (username.ToUpper() == "EX" || password.ToUpper() == "EX" || impersonate.ToUpper() == "EX") { return o; } |
| 468 | string olduserinfo = WebApplicationManagerCore.GetCurrentImpersonateIdentityInfo(wa); | 468 | string olduserinfo = WebApplicationManagerCore.GetCurrentImpersonateIdentityInfo(wa); |
| 469 | WebApplicationManagerCore.SetImpersonateIdentity(wa.Xml_ImpersonateIdentityConfigFile, impersonate, username, password); | 469 | WebApplicationManagerCore.SetImpersonateIdentity(wa.Xml_ImpersonateIdentityConfigFile, impersonate, username, password); |
| 470 | ColorConsole.WriteLine($"Impersonate identity changed for webapp {wa.Xml_AppName}."); | 470 | ColorConsole.WriteLine($"Impersonate identity changed for webapp {wa.Xml_AppName}."); |
| @@ -491,7 +491,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -491,7 +491,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 491 | ColorConsole.WriteLine($"Set impersonate-on status (true/false).[Enter]=finish input.EX=exit"); | 491 | ColorConsole.WriteLine($"Set impersonate-on status (true/false).[Enter]=finish input.EX=exit"); |
| 492 | ColorConsole.WriteLine($"Empty in XML={defaultinxml}"); | 492 | ColorConsole.WriteLine($"Empty in XML={defaultinxml}"); |
| 493 | impersonate = ColorConsole.ReadLine().ToUpper(); | 493 | impersonate = ColorConsole.ReadLine().ToUpper(); |
| 494 | - if (impersonate == "EX") { return; } | 494 | + if (impersonate.ToUpper() == "EX") { return; } |
| 495 | else if (impersonate == "") | 495 | else if (impersonate == "") |
| 496 | { | 496 | { |
| 497 | username = wa.Xml_ImpersonateIdentityUsername; | 497 | username = wa.Xml_ImpersonateIdentityUsername; |
| @@ -510,13 +510,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -510,13 +510,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 510 | ColorConsole.WriteLine($"Enter username.[Enter]=finish input.EX=exit"); | 510 | ColorConsole.WriteLine($"Enter username.[Enter]=finish input.EX=exit"); |
| 511 | if (wa.Xml_ImpersonateIdentity) { ColorConsole.WriteLine(defaultinxml); } | 511 | if (wa.Xml_ImpersonateIdentity) { ColorConsole.WriteLine(defaultinxml); } |
| 512 | username = ColorConsole.ReadLine().ToUpper(); | 512 | username = ColorConsole.ReadLine().ToUpper(); |
| 513 | - if (username == "EX") { return; } | 513 | + if (username.ToUpper() == "EX") { return; } |
| 514 | else if (wa.Xml_ImpersonateIdentity && username == "") | 514 | else if (wa.Xml_ImpersonateIdentity && username == "") |
| 515 | { | 515 | { |
| 516 | } | 516 | } |
| 517 | ColorConsole.WriteLine($"Enter password.[Enter]=finish input.Empty=no password.EX=exit"); | 517 | ColorConsole.WriteLine($"Enter password.[Enter]=finish input.Empty=no password.EX=exit"); |
| 518 | password = ColorConsole.ReadLine().ToUpper(); | 518 | password = ColorConsole.ReadLine().ToUpper(); |
| 519 | - if (password == "EX") { return; } | 519 | + if (password.ToUpper() == "EX") { return; } |
| 520 | break; | 520 | break; |
| 521 | //bool valid = System.Web.ApplicationSerices.AuthenticationService.ValidateUser(username, password, mull); | 521 | //bool valid = System.Web.ApplicationSerices.AuthenticationService.ValidateUser(username, password, mull); |
| 522 | } | 522 | } |
| @@ -546,7 +546,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -546,7 +546,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 546 | var wa = p.Parameters as WebApplication; | 546 | var wa = p.Parameters as WebApplication; |
| 547 | ColorConsole.WriteLine($"Set pool identity info for webapp {wa.Xml_AppName}. Pool:{wa.Xml_PoolName}, site:{wa.Xml_SiteName}", ConsoleColor.DarkYellow); | 547 | ColorConsole.WriteLine($"Set pool identity info for webapp {wa.Xml_AppName}. Pool:{wa.Xml_PoolName}, site:{wa.Xml_SiteName}", ConsoleColor.DarkYellow); |
| 548 | GetPoolIdentityInfo(wa, out string username, out string password, out ProcessModelIdentityType poolidentitytype); | 548 | GetPoolIdentityInfo(wa, out string username, out string password, out ProcessModelIdentityType poolidentitytype); |
| 549 | - if (username == "EX" || password == "EX") { return o; } | 549 | + if (username.ToUpper() == "EX" || password.ToUpper() == "EX") { return o; } |
| 550 | string olduserinfo = WebApplicationManagerCore.GetCurrentPoolIdentityInfo(wa); | 550 | string olduserinfo = WebApplicationManagerCore.GetCurrentPoolIdentityInfo(wa); |
| 551 | WebApplicationManagerCore.SetPoolUserAccount(wa.Xml_AppName, wa.Xml_SiteName, username, password, poolidentitytype); | 551 | WebApplicationManagerCore.SetPoolUserAccount(wa.Xml_AppName, wa.Xml_SiteName, username, password, poolidentitytype); |
| 552 | ColorConsole.WriteLine($"Pool identity changed for webapp {wa.Xml_AppName}."); | 552 | ColorConsole.WriteLine($"Pool identity changed for webapp {wa.Xml_AppName}."); |
| @@ -577,7 +577,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -577,7 +577,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 577 | username = ColorConsole.ReadLine().ToUpper(); | 577 | username = ColorConsole.ReadLine().ToUpper(); |
| 578 | password = ""; | 578 | password = ""; |
| 579 | poolidentitytype = ProcessModelIdentityType.SpecificUser; | 579 | poolidentitytype = ProcessModelIdentityType.SpecificUser; |
| 580 | - if (username == "EX") { return; } | 580 | + if (username.ToUpper() == "EX") { return; } |
| 581 | 581 | ||
| 582 | if (string.IsNullOrEmpty(username)) { username=wa.Xml_PoolUsername; password = wa.Xml_PoolPassword; } | 582 | if (string.IsNullOrEmpty(username)) { username=wa.Xml_PoolUsername; password = wa.Xml_PoolPassword; } |
| 583 | 583 |
Vrh.Log4Pro.MaintenanceConsole/Manager - WindowsServiceManager.cs
| @@ -35,7 +35,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -35,7 +35,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 35 | { | 35 | { |
| 36 | var args = (o1 as Menu.ExecutorParameter).Args; | 36 | var args = (o1 as Menu.ExecutorParameter).Args; |
| 37 | var config = new WindowsServiceManagerXmlProcessor(XMLCONNECTIONSTRING, "", "hu-HU"); | 37 | var config = new WindowsServiceManagerXmlProcessor(XMLCONNECTIONSTRING, "", "hu-HU"); |
| 38 | - var selectedserviceindexes = CommandLine.GetCommandLineArgument(args, CLP.Module.WindowsServiceManager.Function.CMD_SERVICES); | 38 | + var selectedservicekeys = CommandLine.GetCommandLineArgument(args, CLP.Module.WindowsServiceManager.Function.CMD_SERVICES); |
| 39 | var functionkey = CommandLine.GetCommandLineArgument(args, CLP.CMD_FUNCTION); | 39 | var functionkey = CommandLine.GetCommandLineArgument(args, CLP.CMD_FUNCTION); |
| 40 | bool exitwasrequested = false; | 40 | bool exitwasrequested = false; |
| 41 | while (true) // servicegroup selection | 41 | while (true) // servicegroup selection |
| @@ -56,7 +56,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -56,7 +56,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 56 | 56 | ||
| 57 | menuservicegroups.DisplayTitle(); | 57 | menuservicegroups.DisplayTitle(); |
| 58 | menuservicegroups.DisplayItems(1); | 58 | menuservicegroups.DisplayItems(1); |
| 59 | - Menu.Selection srg = menuservicegroups.Select(selectedserviceindexes); | 59 | + Menu.Selection srg = menuservicegroups.Select(selectedservicekeys); |
| 60 | if (srg.Result == Menu.SelectionResult.Exit) { break; } | 60 | if (srg.Result == Menu.SelectionResult.Exit) { break; } |
| 61 | else if (srg.Result == Menu.SelectionResult.None) { break; } | 61 | else if (srg.Result == Menu.SelectionResult.None) { break; } |
| 62 | else if (srg.Result == Menu.SelectionResult.Error) { break; } | 62 | else if (srg.Result == Menu.SelectionResult.Error) { break; } |
| @@ -74,13 +74,14 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -74,13 +74,14 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 74 | var menuservices = DisplayWindowsServiceMenu(config, $"Select the windows service(es) to manage!", selectedServicegroups); | 74 | var menuservices = DisplayWindowsServiceMenu(config, $"Select the windows service(es) to manage!", selectedServicegroups); |
| 75 | //menuservices.DisplayTitle(); | 75 | //menuservices.DisplayTitle(); |
| 76 | menuservices.DisplayItems(1, listheader: selectedServicegroups == null ? null : "Services for groups: " + string.Join(",", selectedServicegroups.GetOneLineInfoList())); | 76 | menuservices.DisplayItems(1, listheader: selectedServicegroups == null ? null : "Services for groups: " + string.Join(",", selectedServicegroups.GetOneLineInfoList())); |
| 77 | - Menu.Selection sr = menuservices.Select(selectedserviceindexes); | 77 | + Menu.Selection sr = menuservices.Select(selectedservicekeys); |
| 78 | if (sr.Result == Menu.SelectionResult.Exit) { exitwasrequested = true; break; } | 78 | if (sr.Result == Menu.SelectionResult.Exit) { exitwasrequested = true; break; } |
| 79 | else if (sr.Result == Menu.SelectionResult.None) { break; } | 79 | else if (sr.Result == Menu.SelectionResult.None) { break; } |
| 80 | else if (sr.Result == Menu.SelectionResult.Error) { break; } | 80 | else if (sr.Result == Menu.SelectionResult.Error) { break; } |
| 81 | else if (sr.Result == Menu.SelectionResult.Ok) { } | 81 | else if (sr.Result == Menu.SelectionResult.Ok) { } |
| 82 | else { } | 82 | else { } |
| 83 | selectedServices = sr.SelectedParameterList.Select(p => (p.Parameters as WindowsService)).ToList(); | 83 | selectedServices = sr.SelectedParameterList.Select(p => (p.Parameters as WindowsService)).ToList(); |
| 84 | + var selectedkeylist = sr.SelectedKeyList; | ||
| 84 | 85 | ||
| 85 | var menufunctions = new Menu("Manage Windows Services", "Select the management function!") | 86 | var menufunctions = new Menu("Manage Windows Services", "Select the management function!") |
| 86 | .AddMenuItem(new Menu.Item(CLP.Module.WindowsServiceManager.Function.Register.KEY, "Register")) | 87 | .AddMenuItem(new Menu.Item(CLP.Module.WindowsServiceManager.Function.Register.KEY, "Register")) |
| @@ -159,7 +160,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -159,7 +160,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 159 | catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); } | 160 | catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); } |
| 160 | } | 161 | } |
| 161 | break; | 162 | break; |
| 162 | - break; | ||
| 163 | case CLP.Module.WindowsServiceManager.Function.Kill.KEY: | 163 | case CLP.Module.WindowsServiceManager.Function.Kill.KEY: |
| 164 | foreach (var ws in selectedServices) | 164 | foreach (var ws in selectedServices) |
| 165 | { | 165 | { |
| @@ -171,7 +171,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -171,7 +171,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 171 | catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); } | 171 | catch (Exception ex) { ColorConsole.WriteLine(ex.Message, ConsoleColor.Red); } |
| 172 | } | 172 | } |
| 173 | break; | 173 | break; |
| 174 | - case CLP.Module.WindowsServiceManager.Function.SetUserAccount.KEY: SetUserAccount(config, selectedserviceindexes); break; | 174 | + case CLP.Module.WindowsServiceManager.Function.SetUserAccount.KEY: SetUserAccount(config, string.Join(",",selectedkeylist),forcecommandmode:true); break; |
| 175 | case CLP.Module.WindowsServiceManager.Function.Purge.KEY: Purge(); break; | 175 | case CLP.Module.WindowsServiceManager.Function.Purge.KEY: Purge(); break; |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| @@ -188,7 +188,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -188,7 +188,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 188 | ColorConsole.WriteLine($"Enter servicename mask to select from the result list (% and ? are wildchars)...", ConsoleColor.Yellow); | 188 | ColorConsole.WriteLine($"Enter servicename mask to select from the result list (% and ? are wildchars)...", ConsoleColor.Yellow); |
| 189 | ColorConsole.WriteLine($"...or enter service name directly (put an asterisk (*) before the name).", ConsoleColor.Yellow); | 189 | ColorConsole.WriteLine($"...or enter service name directly (put an asterisk (*) before the name).", ConsoleColor.Yellow); |
| 190 | var mask = ColorConsole.ReadLine($" ---> ", ConsoleColor.Yellow).ToUpper(); | 190 | var mask = ColorConsole.ReadLine($" ---> ", ConsoleColor.Yellow).ToUpper(); |
| 191 | - if (mask == "EX") { return; } | 191 | + if (mask.ToUpper() == "EX") { return; } |
| 192 | else if (mask == "") { continue; } | 192 | else if (mask == "") { continue; } |
| 193 | 193 | ||
| 194 | if (mask.StartsWith("*") && mask.Length>=2) { DeleteOneService(mask.Substring(1)); } | 194 | if (mask.StartsWith("*") && mask.Length>=2) { DeleteOneService(mask.Substring(1)); } |
| @@ -225,7 +225,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -225,7 +225,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 225 | ColorConsole.Write(servicename, ConsoleColor.White, bracket: "''"); | 225 | ColorConsole.Write(servicename, ConsoleColor.White, bracket: "''"); |
| 226 | ColorConsole.Write($"!", ConsoleColor.Yellow); | 226 | ColorConsole.Write($"!", ConsoleColor.Yellow); |
| 227 | var confirmation = ColorConsole.ReadLine(prefix: " ---> ").ToUpper(); | 227 | var confirmation = ColorConsole.ReadLine(prefix: " ---> ").ToUpper(); |
| 228 | - if (confirmation == "EX") { return true; } | 228 | + if (confirmation.ToUpper() == "EX") { return true; } |
| 229 | else if (confirmation == "") | 229 | else if (confirmation == "") |
| 230 | { | 230 | { |
| 231 | ColorConsole.WriteLine($"Service '{servicename}' NOT deleted!", ConsoleColor.Green); | 231 | ColorConsole.WriteLine($"Service '{servicename}' NOT deleted!", ConsoleColor.Green); |
| @@ -237,11 +237,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -237,11 +237,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 237 | } | 237 | } |
| 238 | return false; | 238 | return false; |
| 239 | } | 239 | } |
| 240 | - private static void SetUserAccount(WindowsServiceManagerXmlProcessor config, string selectedserviceindexes) | 240 | + private static void SetUserAccount(WindowsServiceManagerXmlProcessor config, string selectedservicekeys, bool forcecommandmode=false) |
| 241 | { | 241 | { |
| 242 | var menuservices = DisplayWindowsServiceMenu(config, $"Select the windows service(es) to manage with function '{nameof(SetUserAccount)}'!"); | 242 | var menuservices = DisplayWindowsServiceMenu(config, $"Select the windows service(es) to manage with function '{nameof(SetUserAccount)}'!"); |
| 243 | 243 | ||
| 244 | - Menu.Selection sr = menuservices.Select(selectedserviceindexes); | 244 | + Menu.Selection sr = menuservices.Select(selectedservicekeys,forcecommandmode); |
| 245 | if (sr.Result == Menu.SelectionResult.Exit) { return; } | 245 | if (sr.Result == Menu.SelectionResult.Exit) { return; } |
| 246 | else if (sr.Result == Menu.SelectionResult.None) { return; } | 246 | else if (sr.Result == Menu.SelectionResult.None) { return; } |
| 247 | else if (sr.Result == Menu.SelectionResult.Error) { return; } | 247 | else if (sr.Result == Menu.SelectionResult.Error) { return; } |
| @@ -259,7 +259,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -259,7 +259,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 259 | if (username == null) | 259 | if (username == null) |
| 260 | { | 260 | { |
| 261 | GetUsernameAndPassword(wmiService,ws,out username, out password); | 261 | GetUsernameAndPassword(wmiService,ws,out username, out password); |
| 262 | - if (username == "EX" || password == "EX") { return; } | 262 | + if (username.ToUpper() == "EX" || password.ToUpper() == "EX") { return; } |
| 263 | } | 263 | } |
| 264 | if (WindowsServiceManagerCore.SetUserAccount(wmiService, username, password)) { ColorConsole.WriteLine($"Service user account changed. Name:{ws.Name}", ConsoleColor.Green); } | 264 | if (WindowsServiceManagerCore.SetUserAccount(wmiService, username, password)) { ColorConsole.WriteLine($"Service user account changed. Name:{ws.Name}", ConsoleColor.Green); } |
| 265 | else { ColorConsole.WriteLine($"Service user account change FAILED! Name:{ws.Name}", ConsoleColor.Red); } | 265 | else { ColorConsole.WriteLine($"Service user account change FAILED! Name:{ws.Name}", ConsoleColor.Red); } |
| @@ -373,6 +373,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -373,6 +373,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 373 | if (Menu.IsCommandMode()) { username = ws.Xml_Username; password = ws.Xml_Password; return; } | 373 | if (Menu.IsCommandMode()) { username = ws.Xml_Username; password = ws.Xml_Password; return; } |
| 374 | 374 | ||
| 375 | string olduserinfo = WindowsServiceManagerCore.GetUserInfo(wmiService); | 375 | string olduserinfo = WindowsServiceManagerCore.GetUserInfo(wmiService); |
| 376 | + ColorConsole.WriteLine($"Service: {ws.Name}({ws.DisplayName},{ws.Description})",f:ConsoleColor.Yellow); | ||
| 376 | ColorConsole.WriteLine($"Current user info: {olduserinfo}"); | 377 | ColorConsole.WriteLine($"Current user info: {olduserinfo}"); |
| 377 | ColorConsole.WriteLine("Enter username then password. [Enter]=save.EX=exit"); | 378 | ColorConsole.WriteLine("Enter username then password. [Enter]=save.EX=exit"); |
| 378 | ColorConsole.WriteLine("Username is in the form of 'domainname\\username'"); | 379 | ColorConsole.WriteLine("Username is in the form of 'domainname\\username'"); |
| @@ -387,7 +388,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -387,7 +388,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 387 | ColorConsole.WriteLine($"EX", ConsoleColor.Red, bracket: "()", prefix: " ", suffix: " Exit"); | 388 | ColorConsole.WriteLine($"EX", ConsoleColor.Red, bracket: "()", prefix: " ", suffix: " Exit"); |
| 388 | 389 | ||
| 389 | username = ColorConsole.ReadLine("username -->", ConsoleColor.Yellow, bracket: "[]"); | 390 | username = ColorConsole.ReadLine("username -->", ConsoleColor.Yellow, bracket: "[]"); |
| 390 | - if (username == "EX") { return; } | 391 | + if (username.ToUpper() == "EX") { return; } |
| 391 | else if (string.IsNullOrEmpty(username)) { username = ws.Xml_Username; password = ws.Xml_Password; } | 392 | else if (string.IsNullOrEmpty(username)) { username = ws.Xml_Username; password = ws.Xml_Password; } |
| 392 | else if (username.ToUpper() == "LSE" || username == nameof(ServiceAccount.LocalService)) { username = nameof(ServiceAccount.LocalService); } | 393 | else if (username.ToUpper() == "LSE" || username == nameof(ServiceAccount.LocalService)) { username = nameof(ServiceAccount.LocalService); } |
| 393 | else if (username.ToUpper() == "LSY" || username == nameof(ServiceAccount.LocalSystem)) { username = nameof(ServiceAccount.LocalSystem); } | 394 | else if (username.ToUpper() == "LSY" || username == nameof(ServiceAccount.LocalSystem)) { username = nameof(ServiceAccount.LocalSystem); } |
| @@ -395,7 +396,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -395,7 +396,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 395 | else | 396 | else |
| 396 | { | 397 | { |
| 397 | password = ColorConsole.ReadLine("password -->", ConsoleColor.Yellow, bracket: "[]"); | 398 | password = ColorConsole.ReadLine("password -->", ConsoleColor.Yellow, bracket: "[]"); |
| 398 | - if (password == "EX") { return; } | 399 | + if (password.ToUpper() == "EX") { return; } |
| 399 | } | 400 | } |
| 400 | } | 401 | } |
| 401 | #endregion private GetUsernameAndPassword | 402 | #endregion private GetUsernameAndPassword |
Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs
| @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | ||
| 32 | // You can specify all the values or you can default the Build and Revision Numbers | 32 | // You can specify all the values or you can default the Build and Revision Numbers |
| 33 | // by using the '*' as shown below: | 33 | // by using the '*' as shown below: |
| 34 | // [assembly: AssemblyVersion("1.0.*")] | 34 | // [assembly: AssemblyVersion("1.0.*")] |
| 35 | -[assembly: AssemblyVersion("1.19.1.0")] | ||
| 36 | -[assembly: AssemblyFileVersion("1.19.1.0")] | 35 | +[assembly: AssemblyVersion("1.19.2.0")] |
| 36 | +[assembly: AssemblyFileVersion("1.19.2.0")] |
Vrh.Log4Pro.MaintenanceConsole/Tools.cs
| @@ -333,7 +333,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | @@ -333,7 +333,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS | ||
| 333 | if (kvp.Value.Substring(1).IndexOf('?') != -1) kvpdefaultvalue = kvp.Value.Substring(1).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[1]; | 333 | if (kvp.Value.Substring(1).IndexOf('?') != -1) kvpdefaultvalue = kvp.Value.Substring(1).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[1]; |
| 334 | } | 334 | } |
| 335 | string value = ColorConsole.ReadLine(prompt, ConsoleColor.Yellow, defaultvalue: kvpdefaultvalue); | 335 | string value = ColorConsole.ReadLine(prompt, ConsoleColor.Yellow, defaultvalue: kvpdefaultvalue); |
| 336 | - if (value.ToLower() == "ex") { return false; } | 336 | + if (value.ToUpper() == "EX") { return false; } |
| 337 | resolveddictionary.Add(kvp.Key, value); | 337 | resolveddictionary.Add(kvp.Key, value); |
| 338 | } | 338 | } |
| 339 | else if (kvp.Value.StartsWith("?") && !interactive) resolveddictionary.Add(kvp.Key, $"{{{kvp.Key}}}"); | 339 | else if (kvp.Value.StartsWith("?") && !interactive) resolveddictionary.Add(kvp.Key, $"{{{kvp.Key}}}"); |