Commit 41698df242496be7da6f224e5ea292680ae7f158
1 parent
b629ffb6
v1.10.0.0
- Külső exe indítás paraméterezhetőségeése
Showing
2 changed files
with
34 additions
and
7 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/Manager - MaintenanceToolManager.cs
| ... | ... | @@ -16,7 +16,7 @@ using Vrh.Log4Pro.MaintenanceConsole.MenuNS; |
| 16 | 16 | using Vrh.Log4Pro.MaintenanceConsole.ColorConsoleNS; |
| 17 | 17 | using Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS; |
| 18 | 18 | using Vrh.Log4Pro.MaintenanceConsole.ToolsNS; |
| 19 | - | |
| 19 | +using VRH.Common; | |
| 20 | 20 | |
| 21 | 21 | using Vrh.XmlProcessing; |
| 22 | 22 | using System.Xml.Linq; |
| ... | ... | @@ -54,7 +54,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 54 | 54 | #endregion Execute |
| 55 | 55 | |
| 56 | 56 | #region First level Executors with UI |
| 57 | - private static object ExternalUtilityStarter(object parameter, object o) | |
| 57 | + private static object ExternalUtilityStarter(object parameter, object o) | |
| 58 | 58 | { |
| 59 | 59 | var config = (parameter as Menu.ExecutorParameter).GetConfig2<MaintenanceToolsXmlProcessor.ExternalUtilityConfig>(); |
| 60 | 60 | using (System.Diagnostics.Process pProcess = new System.Diagnostics.Process()) |
| ... | ... | @@ -62,6 +62,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 62 | 62 | Process ExternalProcess = new Process(); |
| 63 | 63 | ExternalProcess.StartInfo.FileName = config.Exe; |
| 64 | 64 | ExternalProcess.StartInfo.WindowStyle = config.ProcessWindowsStyle; |
| 65 | + | |
| 66 | + ExternalProcess.StartInfo.Arguments = config.Arguments; | |
| 65 | 67 | ExternalProcess.Start(); |
| 66 | 68 | int waitingtime = config.WaitForExit ? -1 : 0; |
| 67 | 69 | ExternalProcess.WaitForExit(waitingtime); |
| ... | ... | @@ -380,19 +382,42 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 380 | 382 | { |
| 381 | 383 | public ExternalUtilityConfig(XElement x) |
| 382 | 384 | { |
| 383 | - Key = GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Key), x, ""); | |
| 384 | - Exe= GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Exe), x, ""); | |
| 385 | - Description = GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Description), x, Exe); | |
| 385 | + ArgumentParametersDictionary = GetValue(nameof(XmlStructure.ExternalUtility.Attributes.ArgumentParameters), x, XmlStructure.ExternalUtility.Attributes.ArgumentParameters.Values.DEFAULT).Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries) | |
| 386 | + .Select(kvp => CreateKVP(kvp)) | |
| 387 | + .Where(kvp => kvp.Key != null) | |
| 388 | + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); | |
| 389 | + | |
| 390 | + Key = VRH.Common.StringConstructor.ResolveConstructorR(ArgumentParametersDictionary, GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Key), x, ""), "{}@@"); | |
| 391 | + Description = VRH.Common.StringConstructor.ResolveConstructorR(ArgumentParametersDictionary, GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Description), x, Exe), "{}@@"); | |
| 392 | + Arguments = VRH.Common.StringConstructor.ResolveConstructorR(ArgumentParametersDictionary, GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Arguments), x, XmlStructure.ExternalUtility.Attributes.Arguments.Values.DEFAULT), "{}@@"); | |
| 393 | + | |
| 394 | + Exe = GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Exe), x, ""); | |
| 386 | 395 | ProcessWindowsStyle = GetValue<ProcessWindowStyle>(nameof(XmlStructure.ExternalUtility.Attributes.WindowStyle), x, XmlStructure.ExternalUtility.Attributes.WindowStyle.Values.DEFAULT); |
| 387 | 396 | WaitForExit= GetValue(nameof(XmlStructure.ExternalUtility.Attributes.WaitForExit), x, XmlStructure.ExternalUtility.Attributes.WaitForExit.Values.DEFAULT); |
| 388 | 397 | Valid = !string.IsNullOrWhiteSpace(Key) && !string.IsNullOrWhiteSpace(Exe) && !string.IsNullOrWhiteSpace(Description); |
| 389 | 398 | } |
| 390 | 399 | public string Key = XmlStructure.ExternalUtility.Attributes.Key.Values.DEFAULT; |
| 391 | 400 | public string Description = XmlStructure.ExternalUtility.Attributes.Description.Values.DEFAULT; |
| 401 | + public string Arguments = XmlStructure.ExternalUtility.Attributes.Arguments.Values.DEFAULT; | |
| 402 | + public Dictionary<string,string> ArgumentParametersDictionary = null; | |
| 392 | 403 | public string Exe = XmlStructure.ExternalUtility.Attributes.Exe.Values.DEFAULT; |
| 393 | 404 | public ProcessWindowStyle ProcessWindowsStyle = XmlStructure.ExternalUtility.Attributes.WindowStyle.Values.DEFAULT; |
| 394 | 405 | public bool WaitForExit=XmlStructure.ExternalUtility.Attributes.WaitForExit.Values.DEFAULT; |
| 395 | 406 | public bool Valid; |
| 407 | + | |
| 408 | + private static KeyValuePair<string, string> CreateKVP(string kvpstring) | |
| 409 | + { | |
| 410 | + string kvpk = null; | |
| 411 | + string kvpv = null; | |
| 412 | + try | |
| 413 | + { | |
| 414 | + kvpk = kvpstring.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries)[0]; if (string.IsNullOrWhiteSpace(kvpk)) { kvpk = null; } | |
| 415 | + kvpv = kvpstring.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries)[1]; | |
| 416 | + KeyValuePair<string, string> r = new KeyValuePair<string, string>(kvpk, kvpv); | |
| 417 | + return r; | |
| 418 | + } | |
| 419 | + catch { return new KeyValuePair<string, string>(kvpk, null); } | |
| 420 | + } | |
| 396 | 421 | } |
| 397 | 422 | public XElement RegexpTesterConfig; |
| 398 | 423 | public XElement PingerConfigXml; |
| ... | ... | @@ -446,6 +471,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 446 | 471 | public static class Key { public static class Values { public static string DEFAULT = ""; } } |
| 447 | 472 | public static class Description { public static class Values { public static string DEFAULT = ""; } } |
| 448 | 473 | public static class Exe { public static class Values { public static string DEFAULT = ""; } } |
| 474 | + public static class Arguments{ public static class Values { public static string DEFAULT = ""; } } | |
| 475 | + public static class ArgumentParameters { public static class Values { public static string DEFAULT = ""; } } | |
| 449 | 476 | public static class WindowStyle { public static class Values { public static ProcessWindowStyle DEFAULT = ProcessWindowStyle.Normal; } } |
| 450 | 477 | public static class WaitForExit { public static class Values { public static bool DEFAULT = true; } } |
| 451 | 478 | } | ... | ... |
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.9.3.0")] | |
| 36 | -[assembly: AssemblyFileVersion("1.9.3.0")] | |
| 35 | +[assembly: AssemblyVersion("1.10.0.0")] | |
| 36 | +[assembly: AssemblyFileVersion("1.10.0.0")] | ... | ... |