Commit 0cafa26d5985df8890d868ea1f77a50a885b351e
1 parent
2ff9a39c
InstallManager létrehozása és alap funkciók hozzáadása
Showing
10 changed files
with
339 additions
and
16 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - CommandLineParser.cs
| ... | ... | @@ -206,6 +206,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS |
| 206 | 206 | { |
| 207 | 207 | public const string CMD_WEBAPPS = "-WEBAPPS"; |
| 208 | 208 | public static class Register { public const string KEY = "WAR"; } |
| 209 | + public static class ConfigureIIS { public const string KEY = "IIS"; } | |
| 209 | 210 | public static class Unregister { public const string KEY = "WAU"; } |
| 210 | 211 | public static class SetImpersonateIdentity { public const string KEY = "WAI"; } |
| 211 | 212 | public static class PoolStart { public const string KEY = "APS"; } |
| ... | ... | @@ -282,14 +283,24 @@ namespace Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS |
| 282 | 283 | public static class RelocatePhysicalFiles { public const string KEY = "COP"; } |
| 283 | 284 | } |
| 284 | 285 | } |
| 286 | + | |
| 287 | + public static class InstallManager | |
| 288 | + { | |
| 289 | + public const string KEY = "INM"; | |
| 290 | + public static class Functions | |
| 291 | + { | |
| 292 | + public static class EnvironmentInstall { public const string KEY = "ENV"; } | |
| 293 | + public static class RestartServer { public const string KEY = "RST"; } | |
| 294 | + public static class ConfigureIIS { public const string KEY = "IIS"; } | |
| 295 | + } | |
| 296 | + } | |
| 285 | 297 | public static class MaintenanceToolManager |
| 286 | 298 | { |
| 287 | 299 | public const string KEY = "TOL"; |
| 288 | 300 | public static class Functions |
| 289 | 301 | { |
| 290 | 302 | public static class RegexTester { public const string KEY = "RGX"; } |
| 291 | - public static class Tool1 { public const string KEY = "TL1"; } | |
| 292 | - public static class Tool2 { public const string KEY = "TL2"; } | |
| 303 | + public static class Tool { public const string KEY = "TOL"; } | |
| 293 | 304 | } |
| 294 | 305 | } |
| 295 | 306 | } | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Tools - Membership.cs
| ... | ... | @@ -421,7 +421,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS |
| 421 | 421 | /// <returns></returns> |
| 422 | 422 | public static VRH.Common.ReturnInfoJSON RolesToUser(string rolenamecommalist, string usernamecommalist) |
| 423 | 423 | { |
| 424 | - DAL.RoleGroup urg; | |
| 425 | 424 | ReturnInfoJSON result = new ReturnInfoJSON() { ReturnMessage = "Assignment was successful!" }; |
| 426 | 425 | try |
| 427 | 426 | { | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Tools.cs
| ... | ... | @@ -174,5 +174,40 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ToolsNS |
| 174 | 174 | if (extension == null) { extension = ".tmp"; } |
| 175 | 175 | return Path.Combine(directorypath, DateTime.Now.ToString($"TMP_yyyyMMddHHmmssfffffff.{extension}")); |
| 176 | 176 | } |
| 177 | + public static void ShutDown(ShutDownMode oparation) | |
| 178 | + { | |
| 179 | + string filename = string.Empty; | |
| 180 | + string arguments = string.Empty; | |
| 181 | + switch (oparation) | |
| 182 | + { | |
| 183 | + case ShutDownMode.ShutDown: | |
| 184 | + filename = "shutdown.exe"; | |
| 185 | + arguments = "-s"; | |
| 186 | + break; | |
| 187 | + case ShutDownMode.Restart: | |
| 188 | + filename = "shutdown.exe"; | |
| 189 | + arguments = "-r"; | |
| 190 | + break; | |
| 191 | + case ShutDownMode.Logoff: | |
| 192 | + filename = "shutdown.exe"; | |
| 193 | + arguments = "-l"; | |
| 194 | + break; | |
| 195 | + case ShutDownMode.Lock: | |
| 196 | + filename = "Rundll32.exe"; | |
| 197 | + arguments = "User32.dll, LockWorkStation"; | |
| 198 | + break; | |
| 199 | + case ShutDownMode.Hibernation: | |
| 200 | + filename = @"%windir%\system32\rundll32.exe"; | |
| 201 | + arguments = "PowrProf.dll, SetSuspendState"; | |
| 202 | + break; | |
| 203 | + case ShutDownMode.Sleep: | |
| 204 | + filename = "Rundll32.exe"; | |
| 205 | + arguments = "powrprof.dll, SetSuspendState 0,1,0"; | |
| 206 | + break; | |
| 207 | + } | |
| 208 | + ProcessStartInfo startinfo = new ProcessStartInfo(filename, arguments); | |
| 209 | + Process.Start(startinfo); | |
| 210 | + } | |
| 211 | + public enum ShutDownMode { Sleep, Hibernation,Lock,Logoff,Restart,ShutDown,} | |
| 177 | 212 | } |
| 178 | 213 | } | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Manager - InstallManager.cs
0 → 100644
| ... | ... | @@ -0,0 +1,163 @@ |
| 1 | +using System; | |
| 2 | +using System.IO; | |
| 3 | +using System.Configuration.Install; | |
| 4 | +using System.Collections.Generic; | |
| 5 | +using System.Linq; | |
| 6 | +using System.ServiceProcess; | |
| 7 | +using System.Text; | |
| 8 | +using System.Threading; | |
| 9 | +using System.Threading.Tasks; | |
| 10 | + | |
| 11 | +using Microsoft.Web.Administration; | |
| 12 | +using System.Management; | |
| 13 | +using System.Diagnostics; | |
| 14 | + | |
| 15 | +using Vrh.Log4Pro.MaintenanceConsole.MenuNS; | |
| 16 | +using Vrh.Log4Pro.MaintenanceConsole.ColorConsoleNS; | |
| 17 | +using Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS; | |
| 18 | +using Vrh.Log4Pro.MaintenanceConsole.ToolsNS; | |
| 19 | +using Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS; | |
| 20 | + | |
| 21 | + | |
| 22 | +using Vrh.XmlProcessing; | |
| 23 | +using System.Xml.Linq; | |
| 24 | +using System.Text.RegularExpressions; | |
| 25 | + | |
| 26 | +namespace Vrh.Log4Pro.MaintenanceConsole.InstallManagerNS | |
| 27 | +{ | |
| 28 | + #region MaintenanceTools class | |
| 29 | + public static class InstallManager | |
| 30 | + { | |
| 31 | + private const string XMLCONNECTIONSTRING = "config=MAINTENANCECONSOLE_INSTALLMANAGER;"; | |
| 32 | + private const string XMLCONNECTIONSTRING_DEFAULT = "file=Config.Xml;element=InstallManager;"; | |
| 33 | + | |
| 34 | + #region Execute | |
| 35 | + public static object Execute(object o1 = null, object o2 = null) | |
| 36 | + { | |
| 37 | + var args = (o1 as Menu.ExecutorParameter).Args; | |
| 38 | + string xmlcs = XMLCONNECTIONSTRING; | |
| 39 | + var config = new InstallManagerXmlParser(xmlcs, "", "hu-HU"); | |
| 40 | + | |
| 41 | + var epWA = WebApplicationManager.GetExecutorParameter(args); | |
| 42 | + | |
| 43 | + var menufunctions = new Menu("Install Manager", "Select function!") | |
| 44 | + .AddMenuItem(new Menu.Item(CLP.Module.InstallManager.Functions.EnvironmentInstall.KEY, "Environment install", EnvironmentInstall, new Menu.ExecutorParameter(cfg: config, null))) | |
| 45 | + .AddMenuItem(new Menu.Item(CLP.Module.WebApplicationManager.Function.ConfigureIIS.KEY, "Configure IIS Default App Pool", WebApplicationManager.ConfigIIS, epWA)) | |
| 46 | + .AddMenuItem(new Menu.ItemSeparator()) | |
| 47 | + .AddMenuItem(new Menu.Item(CLP.Module.InstallManager.Functions.RestartServer.KEY, "Restart server", RestartServer, new Menu.ExecutorParameter(cfg: config, null))) | |
| 48 | + .SetSelectionMode(Menu.SelectionMode.Single); | |
| 49 | + menufunctions.ExecuteMenu(); | |
| 50 | + return null; | |
| 51 | + } | |
| 52 | + #endregion Execute | |
| 53 | + | |
| 54 | + #region First level Executors with UI | |
| 55 | + #region EnvironmentInstall | |
| 56 | + private static object EnvironmentInstall(object parameter, object o) | |
| 57 | + { | |
| 58 | + var config = (parameter as Menu.ExecutorParameter).GetConfig<InstallManagerXmlParser>(); | |
| 59 | + InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.Group.Values grp; | |
| 60 | + InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values os; | |
| 61 | + string answer; | |
| 62 | + foreach (var wfg in config.WindowsFeatureGroups) | |
| 63 | + { | |
| 64 | + grp = wfg.Group; | |
| 65 | + os = wfg.OS; | |
| 66 | + answer = ColorConsole.ReadLine($"Do You want to configure feature group '{grp}' for os '{os}'?(Y/N)", ConsoleColor.Yellow); | |
| 67 | + if (answer.ToUpper() == "Y") { EnableWindowsFeatures(grp, os, config); } | |
| 68 | + }; | |
| 69 | + return o; | |
| 70 | + } | |
| 71 | + private static void EnableWindowsFeatures(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.Group.Values grp | |
| 72 | + , InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values os, InstallManagerXmlParser environmentinstallconfig) | |
| 73 | + { | |
| 74 | + ColorConsole.WriteLine($"Enableing {grp} features for os {os}...",ConsoleColor.Yellow); | |
| 75 | + foreach (var fn in environmentinstallconfig.GetFeatureList(os,grp)) | |
| 76 | + { | |
| 77 | + if (string.IsNullOrWhiteSpace(fn) || fn.StartsWith("#")) { continue; } | |
| 78 | + ColorConsole.WriteLine($"Enableing {grp} features for os {os}. Feature name: {fn}.",ConsoleColor.Yellow); | |
| 79 | + string response; | |
| 80 | + switch (os) | |
| 81 | + { | |
| 82 | + case InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values.WS2016: | |
| 83 | + response = Tools.ExecuteAndGetStdIo("Install-WindowsFeature", $"-Name {fn} -IncludeAllSubFeature -IncludeManagementTools"); | |
| 84 | + break; | |
| 85 | + case InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values.W7: | |
| 86 | + response = Tools.ExecuteAndGetStdIo("dism", $"/online /Enable-Feature /FeatureName:{fn}"); | |
| 87 | + break; | |
| 88 | + default: break; | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 92 | + #endregion EnvironmentInstall | |
| 93 | + #region Restart server | |
| 94 | + private static object RestartServer(object parameter, object o) | |
| 95 | + { | |
| 96 | + var config = parameter as InstallManagerXmlParser; | |
| 97 | + string answer = ColorConsole.ReadLine($"Do You want to restart server?(Y/N)", ConsoleColor.Yellow); | |
| 98 | + if (answer.ToUpper() == "Y") | |
| 99 | + { | |
| 100 | + ColorConsole.WriteLine($"Restarting...", ConsoleColor.Yellow); | |
| 101 | + Tools.ShutDown(Tools.ShutDownMode.Restart); | |
| 102 | + } | |
| 103 | + return o; | |
| 104 | + } | |
| 105 | + #endregion Restart server | |
| 106 | + | |
| 107 | + #endregion First level Executors with UI | |
| 108 | + } | |
| 109 | + #endregion MaintenanceTools class | |
| 110 | + | |
| 111 | + #region InstallManagerXmlParser class | |
| 112 | + public class InstallManagerXmlParser: XmlParser | |
| 113 | + { | |
| 114 | + public InstallManagerXmlParser(string xmlcs, string basefolder, string lcid) : base(xmlcs, basefolder, lcid, null) | |
| 115 | + { | |
| 116 | + WindowsFeatureGroups = new List<WindowsFeatures>(); | |
| 117 | + foreach (var wfgXml in GetAllXElements(nameof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall),nameof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList))) | |
| 118 | + { | |
| 119 | + try { WindowsFeatureGroups.Add(new WindowsFeatures(wfgXml)); } | |
| 120 | + catch { } | |
| 121 | + } | |
| 122 | + } | |
| 123 | + public class WindowsFeatures: XmlLinqBase | |
| 124 | + { | |
| 125 | + public WindowsFeatures(XElement wfgXml) | |
| 126 | + { | |
| 127 | + OS = GetValue(nameof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS), wfgXml, InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.DEFAULT); | |
| 128 | + Group = GetValue(nameof(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.Group), wfgXml, InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.Group.DEFAULT); | |
| 129 | + FeatureList = wfgXml.Value?.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList(); | |
| 130 | + } | |
| 131 | + public InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values OS; | |
| 132 | + public InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.Group.Values Group; | |
| 133 | + public List<string> FeatureList; | |
| 134 | + } | |
| 135 | + public List<WindowsFeatures> WindowsFeatureGroups; | |
| 136 | + public List<string> GetFeatureList(InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.OS.Values os, InstallManagerXmlParser.XmlStructure.EnvironmentInstall.WindowsFeatureList.Attributes.Group.Values group) { return WindowsFeatureGroups?.FirstOrDefault(x => x.OS == os && x.Group == group)?.FeatureList; } | |
| 137 | + #region XmlStructure | |
| 138 | + public static class XmlStructure | |
| 139 | + { | |
| 140 | + public static class EnvironmentInstall | |
| 141 | + { | |
| 142 | + public static class WindowsFeatureList | |
| 143 | + { | |
| 144 | + public static class Attributes | |
| 145 | + { | |
| 146 | + public static class OS | |
| 147 | + { | |
| 148 | + public enum Values { WS2016, W7, } | |
| 149 | + public const Values DEFAULT = Values.WS2016; | |
| 150 | + } | |
| 151 | + public static class Group | |
| 152 | + { | |
| 153 | + public enum Values { ALL, IIS, MSMQ, DOTNET, } | |
| 154 | + public const Values DEFAULT = Values.IIS; | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + } | |
| 160 | + #endregion XmlStructure | |
| 161 | + } | |
| 162 | + #endregion InstallManagerXmlParser class | |
| 163 | +} | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Manager - MSMQManager.cs
0 → 100644
| ... | ... | @@ -0,0 +1,83 @@ |
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Messaging; | |
| 5 | +using System.Text; | |
| 6 | +using System.Threading.Tasks; | |
| 7 | + | |
| 8 | +namespace Vrh.Log4Pro.MaintenanceConsole | |
| 9 | +{ | |
| 10 | + class Manager___MSMQManager | |
| 11 | + { | |
| 12 | + void CreateQueue() | |
| 13 | + { | |
| 14 | + string ccs = @"localhost\private$\ljskskin"; | |
| 15 | + string msmqservername = ""; | |
| 16 | + bool msmqprivate = true; | |
| 17 | + string msmqname = ""; | |
| 18 | + string msmqFullname = msmqservername + "\\" + (msmqprivate ? "private$\\" : msmqname); | |
| 19 | + if (!MessageQueue.Exists(ccs)) { MessageQueue.Create(msmqFullname); } | |
| 20 | + } | |
| 21 | + void DeleteQueue() | |
| 22 | + { | |
| 23 | + string ccs = @"localhost\private$\ljskskin"; | |
| 24 | + if (MessageQueue.Exists(ccs)) { MessageQueue.Delete(ccs); } | |
| 25 | + } | |
| 26 | + void Purge() | |
| 27 | + { | |
| 28 | + string ccs = @"localhost\private$\ljskskin"; | |
| 29 | + var msmq = new MessageQueue(ccs); | |
| 30 | + msmq.Purge(); | |
| 31 | + } | |
| 32 | + void Peek() | |
| 33 | + { | |
| 34 | + string ccs = @"localhost\private$\ljskskin"; | |
| 35 | + var msmq = new MessageQueue(ccs); | |
| 36 | + | |
| 37 | + Message m = msmq.Peek(new TimeSpan(0)); | |
| 38 | + m.BodyStream.Position = 0; | |
| 39 | + var sr = new System.IO.StreamReader(m.BodyStream); | |
| 40 | + var label = m.Label; | |
| 41 | + var body = sr.ReadToEnd().Replace(((char)0).ToString(), ""); | |
| 42 | + } | |
| 43 | + void Read() | |
| 44 | + { | |
| 45 | + string ccs = @"localhost\private$\ljskskin"; | |
| 46 | + var msmq = new MessageQueue(ccs); | |
| 47 | + var frmA = new System.Messaging.ActiveXMessageFormatter(); | |
| 48 | + var frmB = new System.Messaging.BinaryMessageFormatter(); | |
| 49 | + var frmX = new System.Messaging.XmlMessageFormatter(); | |
| 50 | + msmq.Formatter = frmA; | |
| 51 | + | |
| 52 | + Message m = msmq.Receive(new TimeSpan(0)); | |
| 53 | + m.BodyStream.Position = 0; | |
| 54 | + | |
| 55 | + Encoding enc = System.Text.Encoding.UTF8; | |
| 56 | + enc = System.Text.Encoding.UTF7; | |
| 57 | + enc = System.Text.Encoding.UTF32; | |
| 58 | + enc = System.Text.Encoding.Unicode; | |
| 59 | + enc = System.Text.Encoding.BigEndianUnicode; | |
| 60 | + enc = System.Text.Encoding.ASCII; | |
| 61 | + enc = System.Text.Encoding.Default; | |
| 62 | + var sr = new System.IO.StreamReader(m.BodyStream, enc); | |
| 63 | + var label = m.Label; | |
| 64 | + var body = sr.ReadToEnd().Replace(((char)0).ToString(), ""); | |
| 65 | + } | |
| 66 | + void Send() | |
| 67 | + { | |
| 68 | + string ccs = @"localhost\private$\ljskskin"; | |
| 69 | + | |
| 70 | + var frmA = new System.Messaging.ActiveXMessageFormatter(); | |
| 71 | + var msmq = new MessageQueue(ccs); | |
| 72 | + msmq.Formatter = frmA; | |
| 73 | + | |
| 74 | + string messagetosend = ""; | |
| 75 | + string messagelabel = ""; | |
| 76 | + | |
| 77 | + Encoding enc = System.Text.Encoding.UTF8; | |
| 78 | + byte[] encodedmessage = enc.GetBytes(messagetosend); | |
| 79 | + | |
| 80 | + msmq.Send(encodedmessage, messagelabel); | |
| 81 | + } | |
| 82 | + } | |
| 83 | +} | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Manager - MaintenanceToolManager.cs
| ... | ... | @@ -15,6 +15,8 @@ using System.Diagnostics; |
| 15 | 15 | using Vrh.Log4Pro.MaintenanceConsole.MenuNS; |
| 16 | 16 | using Vrh.Log4Pro.MaintenanceConsole.ColorConsoleNS; |
| 17 | 17 | using Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS; |
| 18 | +using Vrh.Log4Pro.MaintenanceConsole.ToolsNS; | |
| 19 | + | |
| 18 | 20 | |
| 19 | 21 | using Vrh.XmlProcessing; |
| 20 | 22 | using System.Xml.Linq; |
| ... | ... | @@ -37,8 +39,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 37 | 39 | |
| 38 | 40 | var menufunctions = new Menu("Maintenance Tools", "Select function!") |
| 39 | 41 | .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.Functions.RegexTester.KEY, "Regex tester", RegexTester,new Menu.ExecutorParameter(cfg:config))) |
| 40 | - .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.Functions.Tool1.KEY, "Tool #1", Tool1, new Menu.ExecutorParameter(cfg: config, null))) | |
| 41 | - .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.Functions.Tool2.KEY, "Tool #2", Tool2, new Menu.ExecutorParameter(cfg: config, null))) | |
| 42 | + .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.Functions.Tool.KEY, "Tool sample", Tool2, new Menu.ExecutorParameter(cfg: config, null))) | |
| 42 | 43 | .SetSelectionMode(Menu.SelectionMode.Single); |
| 43 | 44 | menufunctions.ExecuteMenu(); |
| 44 | 45 | return null; |
| ... | ... | @@ -80,13 +81,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 80 | 81 | return o; |
| 81 | 82 | } |
| 82 | 83 | #endregion RegexTester |
| 84 | + | |
| 83 | 85 | #region Tool templates |
| 84 | - private static object Tool1(object parameter, object o) | |
| 85 | - { | |
| 86 | - var config = parameter as MaintenanceToolsXmlProcessor; | |
| 87 | - ColorConsole.ReadLine($"{nameof(Tool1)} is not ready yet...",ConsoleColor.Yellow); | |
| 88 | - return o; | |
| 89 | - } | |
| 90 | 86 | private static object Tool2(object parameter, object o) |
| 91 | 87 | { |
| 92 | 88 | var config = parameter as MaintenanceToolsXmlProcessor; |
| ... | ... | @@ -102,6 +98,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS |
| 102 | 98 | public class MaintenanceToolsXmlProcessor : XmlParser |
| 103 | 99 | { |
| 104 | 100 | public XElement RegexpTesterConfig; |
| 101 | + | |
| 105 | 102 | #region constructor |
| 106 | 103 | public MaintenanceToolsXmlProcessor(string xmlcs, string basefolder, string lcid) : base(xmlcs, basefolder, lcid, null) |
| 107 | 104 | { | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs
| ... | ... | @@ -67,10 +67,10 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS |
| 67 | 67 | if (enabletabledatabackup) { SQLDataBaseManagerCore.BackupSqlData(sqld, timestamp); } |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - #endregion Execute | |
| 70 | + #endregion Execute | |
| 71 | 71 | |
| 72 | - #region First level Executors with UI | |
| 73 | - private static object CreateDataScripts(object parameter, object o) | |
| 72 | + #region First level Executors with UI | |
| 73 | + private static object CreateDataScripts(object parameter, object o) | |
| 74 | 74 | { |
| 75 | 75 | var config = (parameter as Menu.ExecutorParameter).GetConfig<SQLDataBaseManagerXmlProcessor>(); |
| 76 | 76 | var args = (parameter as Menu.ExecutorParameter).Args; |
| ... | ... | @@ -937,7 +937,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.SQLDataBaseManagerNS |
| 937 | 937 | #endregion BackupSqlData |
| 938 | 938 | #endregion private methods |
| 939 | 939 | } |
| 940 | - #endregion class SQLDataBaseManager | |
| 940 | +#endregion class SQLDataBaseManager | |
| 941 | 941 | |
| 942 | 942 | #region SQLDataBaseManager class |
| 943 | 943 | public class SQLDataBaseManagerXmlProcessor : XmlParser | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Manager - WebApplicationManager.cs
| ... | ... | @@ -13,6 +13,7 @@ using System.Diagnostics; |
| 13 | 13 | using Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS; |
| 14 | 14 | using Vrh.Log4Pro.MaintenanceConsole.MenuNS; |
| 15 | 15 | using Vrh.Log4Pro.MaintenanceConsole.ColorConsoleNS; |
| 16 | +using Vrh.Log4Pro.MaintenanceConsole.ToolsNS; | |
| 16 | 17 | |
| 17 | 18 | using Vrh.XmlProcessing; |
| 18 | 19 | using VRH.Common; |
| ... | ... | @@ -23,9 +24,16 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS |
| 23 | 24 | #region WebApplicationManager |
| 24 | 25 | public static class WebApplicationManager |
| 25 | 26 | { |
| 26 | - private const string XMLCONNECTIONSTRING = "config=MAINTENANCECONSOLE_WEBAPPLICATIONMANAGER;"; | |
| 27 | + internal const string XMLCONNECTIONSTRING = "config=MAINTENANCECONSOLE_WEBAPPLICATIONMANAGER;"; | |
| 27 | 28 | private const string XMLCONNECTIONSTRING_DEFAULT = "file=Config.Xml;element=WebApplications;"; |
| 28 | 29 | |
| 30 | + public static Menu.ExecutorParameter GetExecutorParameter(string[] args) | |
| 31 | + { | |
| 32 | + var configWA = new WebApplicationManagerXmlProcessor(XMLCONNECTIONSTRING, "", "hu-HU"); | |
| 33 | + var epWA = new Menu.ExecutorParameter(configWA, args); | |
| 34 | + return epWA; | |
| 35 | + } | |
| 36 | + | |
| 29 | 37 | #region public method: Execute |
| 30 | 38 | public static object Execute(object o1=null,object o2=null) |
| 31 | 39 | { |
| ... | ... | @@ -286,6 +294,16 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS |
| 286 | 294 | ColorConsole.WriteLine($"{d.Xml_SiteName} {successstr}."); |
| 287 | 295 | } |
| 288 | 296 | } |
| 297 | + | |
| 298 | + public static object ConfigIIS(object parameters, object o) | |
| 299 | + { | |
| 300 | + var config = (parameters as Menu.ExecutorParameter).GetConfig<WebApplicationManagerXmlProcessor>(); | |
| 301 | + var args = (parameters as Menu.ExecutorParameter).Args; | |
| 302 | + | |
| 303 | + ColorConsole.WriteLine($"Configuring IIS default web application...",ConsoleColor.Yellow); | |
| 304 | + WebApplicationManagerCore.ConfigIIS(); | |
| 305 | + return o; | |
| 306 | + } | |
| 289 | 307 | private static object Register(object parameters, object o) |
| 290 | 308 | { |
| 291 | 309 | var config = (parameters as Menu.ExecutorParameter).GetConfig<WebApplicationManagerXmlProcessor>(); |
| ... | ... | @@ -613,6 +631,18 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS |
| 613 | 631 | } |
| 614 | 632 | #endregion private method: CollectWebAppInfo |
| 615 | 633 | |
| 634 | + public static void ConfigIIS() | |
| 635 | + { | |
| 636 | + string response = Tools.ExecuteAndGetStdIo(@"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe" ,@"/i"); | |
| 637 | + using (ServerManager serverManager = new ServerManager()) | |
| 638 | + { | |
| 639 | + ApplicationPool pool = serverManager.ApplicationPools["DefaultAppPool"]; | |
| 640 | + pool.Enable32BitAppOnWin64 = true; | |
| 641 | + pool.ManagedRuntimeVersion = "v4.0"; | |
| 642 | + CommitChanges(serverManager, pool.Name); | |
| 643 | + } | |
| 644 | + } | |
| 645 | + | |
| 616 | 646 | #region private method:RegisterWebApplication |
| 617 | 647 | public static void RegisterWebApplication(string sitename, string poolname, string appname, string poolphypath, string sitephypath, int siteport, bool recreatepool, bool recreatesite, bool recreateapp,ManagedPipelineMode plmode) |
| 618 | 648 | { | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Program.cs
| ... | ... | @@ -21,6 +21,7 @@ using Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS; |
| 21 | 21 | using Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS; |
| 22 | 22 | using Vrh.Log4Pro.MaintenanceConsole.MaintenanceToolManagerNS; |
| 23 | 23 | using Vrh.Log4Pro.MaintenanceConsole.UserManagerNS; |
| 24 | +using Vrh.Log4Pro.MaintenanceConsole.InstallManagerNS; | |
| 24 | 25 | |
| 25 | 26 | using Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS; |
| 26 | 27 | |
| ... | ... | @@ -66,6 +67,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole |
| 66 | 67 | .AddMenuItem(new Menu.Item(CLP.Module.BackupPackageManager.KEY, "Backup Package Manager", BackupPackageManager.Execute, new Menu.ExecutorParameter(args: args))) |
| 67 | 68 | .AddMenuItem(new Menu.Item(CLP.Module.SQLDataBaseManager.KEY, "SQL Database Manager", SQLDataBaseManager.Execute, new Menu.ExecutorParameter(args: args))) |
| 68 | 69 | .AddMenuItem(new Menu.Item(CLP.Module.Log4ProUserManager.KEY, "Log4Pro User Manager", UserManager.Execute, new Menu.ExecutorParameter(args: args))) |
| 70 | + .AddMenuItem(new Menu.Item(CLP.Module.InstallManager.KEY, "Install Manager", InstallManager.Execute, new Menu.ExecutorParameter(args: args))) | |
| 69 | 71 | .AddMenuItem(new Menu.ItemSeparator('-')) |
| 70 | 72 | .AddMenuItem(new Menu.Item(CLP.Module.MaintenanceToolManager.KEY, "Maintenance tools", MaintenanceToolManager.Execute, new Menu.ExecutorParameter(args: args))) |
| 71 | 73 | .SetMenuHeaderDisplayer(DisplayComputerInfo) | ... | ... |
Vrh.Log4Pro.MaintenanceConsole/Vrh.Log4Pro.MaintenanceConsole.csproj
| ... | ... | @@ -216,6 +216,7 @@ |
| 216 | 216 | <HintPath>..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath> |
| 217 | 217 | </Reference> |
| 218 | 218 | <Reference Include="System.Management" /> |
| 219 | + <Reference Include="System.Messaging" /> | |
| 219 | 220 | <Reference Include="System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |
| 220 | 221 | <HintPath>..\packages\System.Net.Http.4.1.0\lib\net46\System.Net.Http.dll</HintPath> |
| 221 | 222 | </Reference> |
| ... | ... | @@ -291,6 +292,8 @@ |
| 291 | 292 | <Compile Include="ConsoleFunction - Tools - Membership.cs" /> |
| 292 | 293 | <Compile Include="ConsoleFunction - Tools.cs" /> |
| 293 | 294 | <Compile Include="Manager - BackupPackageManager.cs" /> |
| 295 | + <Compile Include="Manager - InstallManager.cs" /> | |
| 296 | + <Compile Include="Manager - MSMQManager.cs" /> | |
| 294 | 297 | <Compile Include="Manager - UserManager.cs" /> |
| 295 | 298 | <Compile Include="Manager - SQLDataBaseManager.cs" /> |
| 296 | 299 | <Compile Include="Manager - ScheduledTaskManager.cs" /> | ... | ... |