Commit 4515e773689b8e8dbebca5bf2a26fa4cb1ab1238
1 parent
22ea3e7e
v1.5.0
- külső program indítása funkció beépítése
Showing
5 changed files
with
64 additions
and
9 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Menu.cs
... | ... | @@ -541,6 +541,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS |
541 | 541 | { |
542 | 542 | return _config as TXMLPROCESSORTYPE; |
543 | 543 | } |
544 | + public TXMLPROCESSORTYPE GetConfig2<TXMLPROCESSORTYPE>() | |
545 | + where TXMLPROCESSORTYPE : XmlLinqBase | |
546 | + { | |
547 | + return _config as TXMLPROCESSORTYPE; | |
548 | + } | |
544 | 549 | |
545 | 550 | private object _config; |
546 | 551 | public object Parameters; | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Manager - MaintenanceToolManager.cs
... | ... | @@ -41,12 +41,30 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
41 | 41 | .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.Functions.RegexTester.KEY, "Regex tester", RegexTester,new Menu.ExecutorParameter(cfg:config))) |
42 | 42 | .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.Functions.Tool.KEY, "Tool sample", Tool2, new Menu.ExecutorParameter(cfg: config, null))) |
43 | 43 | .SetSelectionMode(Menu.SelectionMode.Single); |
44 | + foreach (var x in config.ExternalUtilityConfigList) | |
45 | + { | |
46 | + menufunctions.AddMenuItem(new Menu.Item(x.Key, x.Description, ExternalUtilityStarter, new Menu.ExecutorParameter(cfg: x, null))); | |
47 | + } | |
44 | 48 | menufunctions.ExecuteMenu(); |
45 | 49 | return null; |
46 | 50 | } |
47 | 51 | #endregion Execute |
48 | 52 | |
49 | 53 | #region First level Executors with UI |
54 | + private static object ExternalUtilityStarter(object parameter, object o) | |
55 | + { | |
56 | + var config = (parameter as Menu.ExecutorParameter).GetConfig2<MaintenanceToolsXmlProcessor.ExternalUtilityConfig>(); | |
57 | + using (System.Diagnostics.Process pProcess = new System.Diagnostics.Process()) | |
58 | + { | |
59 | + Process ExternalProcess = new Process(); | |
60 | + ExternalProcess.StartInfo.FileName = config.Exe; | |
61 | + ExternalProcess.StartInfo.WindowStyle = config.ProcessWindowsStyle; | |
62 | + ExternalProcess.Start(); | |
63 | + int waitingtime = config.WaitForExit ? -1 : 0; | |
64 | + ExternalProcess.WaitForExit(waitingtime); | |
65 | + } | |
66 | + return o; | |
67 | + } | |
50 | 68 | #region RegexTester |
51 | 69 | private static object RegexTester(object parameter, object o) |
52 | 70 | { |
... | ... | @@ -97,18 +115,50 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
97 | 115 | #region MaintenanceToolsXmlProcessor class |
98 | 116 | public class MaintenanceToolsXmlProcessor : XmlParser |
99 | 117 | { |
118 | + public class ExternalUtilityConfig: XmlLinqBase | |
119 | + { | |
120 | + public ExternalUtilityConfig(XElement x) | |
121 | + { | |
122 | + Key = GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Key), x, ""); | |
123 | + Exe= GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Exe), x, ""); | |
124 | + Description = GetValue(nameof(XmlStructure.ExternalUtility.Attributes.Description), x, Exe); | |
125 | + ProcessWindowsStyle = GetValue<ProcessWindowStyle>(nameof(XmlStructure.ExternalUtility.Attributes.WindowStyle), x, XmlStructure.ExternalUtility.Attributes.WindowStyle.Values.DEFAULT); | |
126 | + WaitForExit= GetValue(nameof(XmlStructure.ExternalUtility.Attributes.WaitForExit), x, XmlStructure.ExternalUtility.Attributes.WaitForExit.Values.DEFAULT); | |
127 | + Valid = !string.IsNullOrWhiteSpace(Key) && !string.IsNullOrWhiteSpace(Exe) && !string.IsNullOrWhiteSpace(Description); | |
128 | + } | |
129 | + public string Key = XmlStructure.ExternalUtility.Attributes.Key.Values.DEFAULT; | |
130 | + public string Description = XmlStructure.ExternalUtility.Attributes.Description.Values.DEFAULT; | |
131 | + public string Exe = XmlStructure.ExternalUtility.Attributes.Exe.Values.DEFAULT; | |
132 | + public ProcessWindowStyle ProcessWindowsStyle = XmlStructure.ExternalUtility.Attributes.WindowStyle.Values.DEFAULT; | |
133 | + public bool WaitForExit=XmlStructure.ExternalUtility.Attributes.WaitForExit.Values.DEFAULT; | |
134 | + public bool Valid; | |
135 | + } | |
100 | 136 | public XElement RegexpTesterConfig; |
101 | - | |
137 | + public List<ExternalUtilityConfig> ExternalUtilityConfigList = new List<ExternalUtilityConfig>(); | |
138 | + | |
102 | 139 | #region constructor |
103 | 140 | public MaintenanceToolsXmlProcessor(string xmlcs, string basefolder, string lcid) : base(xmlcs, basefolder, lcid, null) |
104 | 141 | { |
105 | 142 | RegexpTesterConfig = GetXElement(nameof(XmlStructure.RegexpTester)); |
143 | + var euElementList = GetAllXElements(nameof(XmlStructure.ExternalUtility)); | |
144 | + foreach (var euElement in euElementList) { var euc = new ExternalUtilityConfig(euElement); if (euc.Valid && !ExternalUtilityConfigList.Exists(x=>x.Key==euc.Key)) { ExternalUtilityConfigList.Add(euc); } } | |
106 | 145 | } |
107 | 146 | #endregion constructor |
108 | 147 | #region XmlStructure |
109 | 148 | public static class XmlStructure |
110 | 149 | { |
111 | 150 | public static class RegexpTester { } |
151 | + public static class ExternalUtility | |
152 | + { | |
153 | + public static class Attributes | |
154 | + { | |
155 | + public static class Key { public static class Values { public static string DEFAULT = ""; } } | |
156 | + public static class Description { public static class Values { public static string DEFAULT = ""; } } | |
157 | + public static class Exe { public static class Values { public static string DEFAULT = ""; } } | |
158 | + public static class WindowStyle { public static class Values { public static ProcessWindowStyle DEFAULT = ProcessWindowStyle.Normal; } } | |
159 | + public static class WaitForExit { public static class Values { public static bool DEFAULT = true; } } | |
160 | + } | |
161 | + } | |
112 | 162 | } |
113 | 163 | #endregion XmlStructure |
114 | 164 | } | ... | ... |
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.4.0.0")] | |
36 | -[assembly: AssemblyFileVersion("1.4.0.0")] | |
35 | +[assembly: AssemblyVersion("1.5.0.0")] | |
36 | +[assembly: AssemblyFileVersion("1.5.0.0")] | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Vrh.Log4Pro.MaintenanceConsole.csproj
... | ... | @@ -337,14 +337,14 @@ |
337 | 337 | <Reference Include="Microsoft.CSharp" /> |
338 | 338 | <Reference Include="System.Data" /> |
339 | 339 | <Reference Include="System.Xml" /> |
340 | - <Reference Include="VRH.Common, Version=2.21.2.0, Culture=neutral, processorArchitecture=MSIL"> | |
341 | - <HintPath>..\packages\VRH.Common.2.21.2\lib\net45\VRH.Common.dll</HintPath> | |
340 | + <Reference Include="VRH.Common, Version=2.21.3.0, Culture=neutral, processorArchitecture=MSIL"> | |
341 | + <HintPath>..\packages\VRH.Common.2.21.3\lib\net45\VRH.Common.dll</HintPath> | |
342 | 342 | </Reference> |
343 | 343 | <Reference Include="Vrh.Web.Providers, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL"> |
344 | 344 | <HintPath>..\packages\VRH.Web.Providers.2.0.2\lib\net452\Vrh.Web.Providers.dll</HintPath> |
345 | 345 | </Reference> |
346 | - <Reference Include="Vrh.XmlProcessing, Version=1.27.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
347 | - <HintPath>..\packages\Vrh.XmlProcessing.1.27.0\lib\net45\Vrh.XmlProcessing.dll</HintPath> | |
346 | + <Reference Include="Vrh.XmlProcessing, Version=1.27.1.0, Culture=neutral, processorArchitecture=MSIL"> | |
347 | + <HintPath>..\packages\Vrh.XmlProcessing.1.27.1\lib\net45\Vrh.XmlProcessing.dll</HintPath> | |
348 | 348 | </Reference> |
349 | 349 | </ItemGroup> |
350 | 350 | <ItemGroup> | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/packages.config
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | <package id="System.Threading.Timer" version="4.0.1" targetFramework="net472" /> |
72 | 72 | <package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net472" /> |
73 | 73 | <package id="System.Xml.XDocument" version="4.0.11" targetFramework="net472" /> |
74 | - <package id="VRH.Common" version="2.21.2" targetFramework="net472" /> | |
74 | + <package id="VRH.Common" version="2.21.3" targetFramework="net472" /> | |
75 | 75 | <package id="VRH.Web.Providers" version="2.0.2" targetFramework="net472" /> |
76 | - <package id="Vrh.XmlProcessing" version="1.27.0" targetFramework="net472" /> | |
76 | + <package id="Vrh.XmlProcessing" version="1.27.1" targetFramework="net472" /> | |
77 | 77 | </packages> |
78 | 78 | \ No newline at end of file | ... | ... |