Commit 17723d0c57625f96b018f7cb4d8c48dda43ceb6c

Authored by Schwirg László
1 parent b28aff5e

v1.19.2.0

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