diff --git a/Vrh.Log4Pro.MaintenanceConsole.sln b/Vrh.Log4Pro.MaintenanceConsole.sln
new file mode 100644
index 0000000..40c589b
--- /dev/null
+++ b/Vrh.Log4Pro.MaintenanceConsole.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30804.86
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vrh.Log4Pro.MaintenanceConsole", "Vrh.Log4Pro.MaintenanceConsole\Vrh.Log4Pro.MaintenanceConsole.csproj", "{2AF86207-84E8-479F-A466-CA65C606B009}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2AF86207-84E8-479F-A466-CA65C606B009}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2AF86207-84E8-479F-A466-CA65C606B009}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2AF86207-84E8-479F-A466-CA65C606B009}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2AF86207-84E8-479F-A466-CA65C606B009}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {63445CF0-9B46-4509-A9DA-8F125390FDC2}
+ EndGlobalSection
+EndGlobal
diff --git a/Vrh.Log4Pro.MaintenanceConsole/App.config b/Vrh.Log4Pro.MaintenanceConsole/App.config
new file mode 100644
index 0000000..507f944
--- /dev/null
+++ b/Vrh.Log4Pro.MaintenanceConsole/App.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Vrh.Log4Pro.MaintenanceConsole/Config.xml b/Vrh.Log4Pro.MaintenanceConsole/Config.xml
new file mode 100644
index 0000000..1e83aec
--- /dev/null
+++ b/Vrh.Log4Pro.MaintenanceConsole/Config.xml
@@ -0,0 +1,160 @@
+
+
+
+ VRH Starter for Log4ProIS
+ System Starter Service for Log4ProIS System
+ VRH Terminator for Log4ProIS
+ System Terminator Service for Log4ProIS System
+ VRH Redis for Log4ProIS
+ Redis Monitor DataProvider Service for Log4ProIS System
+ VRH iLogger for Log4ProIS
+ iLogger Service for Log4ProIS System
+ VRH ASEMW for CP
+ ASE Middleware Service for Log4Pro CP System
+ VRH ASEDC for CP
+ ASEDC Service for Log4Pro CP System
+
+
+
+ WebAndon Support Request Monitoring System
+ WebALM Monitoring System
+ WebPack Packaging System
+ Log4ProIS WEB Application
+
+
+ C:\Log4ProIS
+ @DIR_ROOT@\CONFIG
+ @DIR_ROOT@\SERVICESCRIPTS
+ @Desktop@\WebPack Folders
+ @DIR_ROOT@\Live Monitor
+
+ @DIR_ROOT@\VRH.StartStopSystem
+ @DIR_ROOT@\Redis
+ @DIR_REDIS@\rdb
+ @DIR_ROOT@\VRH.iLogger
+ @DIR_ILOGGER@\Plugins
+
+ @DIR_ROOT@\ASEemu_CP
+ @DIR_ROOT@\VRH.Log4Pro.ASEMW-DCWF_CP
+ @DIR_ROOT@\VRH.Log4Pro.ASEDC-DCWF_CP
+
+ @DIR_ROOT@\ASEemu_ALM
+ @DIR_ROOT@\VRH.Log4Pro.ASEMW-DCWF_ALM
+ @DIR_ROOT@\VRH.Log4Pro.ASEDC-DCWF_ALM
+ @DIR_ROOT@\VRH.Log4Pro.ASEDC-ASEMON_ALM
+ @DIR_ROOT@\VRH.Log4Pro.ACALM
+
+ @DIR_ROOT@\wwwroot_WebPack
+ @DIR_ROOT@\wwwroot_WebALM
+ @DIR_ROOT@\wwwroot_WebAndon
+ @DIR_ROOT@\wwwroot_Log4ProIS
+
+ @DIR_ROOT@\DB
+
+ C:\Log4ProISBackups
+ @DIR_ROOTBAK@\MSMQtests
+ @DIR_ROOTBAK@\VRH.Logfiles
+ @ILOG@\RedisLog
+ @ILOG@\WindowsEventLogs
+ @ILOG@\WindowsEventLogs
+ @ILOG@\ServiceScriptLogs
+ @DIR_ROOTBAK@\SystemBackups
+ @DIR_ROOTBAK@\BackupDBOnly
+ @DIR_ROOTBAK@\TEMP
+ @DIR_ROOTBAK@\ScheduledSavedReports
+ @DIR_ROOTBAK@\SavedReports
+ @DIR_ROOTBAK@\ExportDataReports
+ @DIR_ROOTBAK@\FTPDownloads
+
+
+ @DIR_SCRIPTS@\ServiceScriptsConfig.xml
+ @DIR_ILOGGERPLUGINS@\VRH.Common.iLogger.TextPlugin.dll.config
+ @DIR_WEBAPPWEBPACK@\WebIdentity.config
+ @DIR_WEBAPPWEBALM@\WebIdentity.config
+ @DIR_WEBAPPWEBANDON@\WebIdentity.config
+ @DIR_WEBAPPLOG4PROIS@\WebIdentity.config
+ @DIR_REDIS@\redis.windows.conf
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs
new file mode 100644
index 0000000..f91854d
--- /dev/null
+++ b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - ColorConsole.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Microsoft.Web.Administration;
+using System.Management;
+using System.Diagnostics;
+
+using Vrh.XmlProcessing;
+using System.Xml.Linq;
+
+namespace Vrh.Log4Pro.MaintenanceConsole
+{
+ #region ColorConsole
+ public static class ColorConsole
+ {
+ public static string WideString(string txt)
+ {
+ if (txt == null) { return null; };
+ if (txt == "") { return " "; };
+ string widetxt = null;
+ for (var i = 0; i < txt.Length; i++) { widetxt += txt[i] + " "; };
+ return widetxt.Substring(0, widetxt.Length - 1);
+ }
+
+ public static string ReadLine(string text = null, ConsoleColor? f = null, ConsoleColor? b = null, string bracket = null, string prefix = "")
+ {
+ Write(text, f, b,bracket,prefix);
+ return Console.ReadLine();
+ }
+ public static void WriteLine(string text = null, ConsoleColor? f = null, ConsoleColor? b = null, string bracket = null,string prefix="", string suffix = "")
+ {
+ Write(text, f, b, bracket,prefix,suffix);
+ Console.WriteLine();
+ }
+ public static void Write(string text = null, ConsoleColor? f = null, ConsoleColor? b = null, string bracket = null, string prefix = "",string suffix="")
+ {
+ if (!string.IsNullOrEmpty(prefix)) { Write(prefix); }
+ if (!string.IsNullOrEmpty(bracket) && bracket.Length==1) { bracket = bracket + bracket; }
+ if (!string.IsNullOrEmpty(bracket)) { Console.Write($"{bracket[0]}"); }
+ ConsoleColor savecolorF = Console.ForegroundColor;
+ ConsoleColor savecolorB = Console.BackgroundColor;
+ if (f != null) { Console.ForegroundColor = (ConsoleColor)f; }
+ if (b != null) { Console.BackgroundColor = (ConsoleColor)b; }
+ if (text != null) { Console.Write($"{text}"); }
+ Console.ForegroundColor = savecolorF;
+ Console.BackgroundColor = savecolorB;
+ if (!string.IsNullOrEmpty(bracket)) { Console.Write($"{bracket[1]}"); }
+ if (!string.IsNullOrEmpty(prefix)) { Write(suffix); }
+ }
+ }
+ #endregion ColorConsole
+}
diff --git a/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - CommandLineParser.cs b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - CommandLineParser.cs
new file mode 100644
index 0000000..b0d56ed
--- /dev/null
+++ b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - CommandLineParser.cs
@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Microsoft.Web.Administration;
+using System.Management;
+using System.Diagnostics;
+
+using Vrh.XmlProcessing;
+using System.Xml.Linq;
+
+namespace Vrh.Log4Pro.MaintenanceConsole
+{
+ #region CommandLineParser
+ public static class CommandLineParser
+ {
+ public static string Quote(this string txt) { return $"\"{txt.EscapeQuotes()}\""; }
+ public static string QuoteS(this string txt) { return $"'{txt.EscapeQuotes("'")}'"; }
+ private static string EscapeQuotes(this string txt,string quotestr="\"")
+ {
+ string escapedtxt = txt.Replace("\"", "\\\"");
+
+ return escapedtxt; ;
+ }
+
+ public static IEnumerable SplitArgs(string commandLine)
+ {
+ var result = new StringBuilder();
+
+ var quoted = false;
+ var escaped = false;
+ var started = false;
+ var allowcaret = false;
+ for (int i = 0; i < commandLine.Length; i++)
+ {
+ var chr = commandLine[i];
+
+ if (chr == '^' && !quoted)
+ {
+ if (allowcaret)
+ {
+ result.Append(chr);
+ started = true;
+ escaped = false;
+ allowcaret = false;
+ }
+ else if (i + 1 < commandLine.Length && commandLine[i + 1] == '^')
+ {
+ allowcaret = true;
+ }
+ else if (i + 1 == commandLine.Length)
+ {
+ result.Append(chr);
+ started = true;
+ escaped = false;
+ }
+ }
+ else if (escaped)
+ {
+ result.Append(chr);
+ started = true;
+ escaped = false;
+ }
+ else if (chr == '"')
+ {
+ quoted = !quoted;
+ started = true;
+ }
+ else if (chr == '\\' && i + 1 < commandLine.Length && commandLine[i + 1] == '"')
+ {
+ escaped = true;
+ }
+ else if (chr == ' ' && !quoted)
+ {
+ if (started) yield return result.ToString();
+ result.Clear();
+ started = false;
+ }
+ else
+ {
+ result.Append(chr);
+ started = true;
+ }
+ }
+
+ if (started) yield return result.ToString();
+ }
+ public static void UnitTest()
+ {
+ Test(1,"One", new[] { "One" });
+ Test(2,"One ", new[] { "One" });
+ Test(3," One", new[] { "One" });
+ Test(4," One ", new[] { "One" });
+ Test(5,"One Two", new[] { "One", "Two" });
+ Test(6,"One Two", new[] { "One", "Two" });
+ Test(7,"One Two", new[] { "One", "Two" });
+ Test(8,"\"One Two\"", new[] { "One Two" });
+ Test(9,"One \"Two Three\"", new[] { "One", "Two Three" });
+ Test(10,"One \"Two Three\" Four", new[] { "One", "Two Three", "Four" });
+ Test(11,"One=\"Two Three\" Four", new[] { "One=Two Three", "Four" });
+ Test(12, "One\"", new[] { "One" });
+ Test(13,"One\"Two Three\" Four", new[] { "OneTwo Three", "Four" });
+ Test(14,"One\"Two Three Four", new[] { "OneTwo Three Four" });
+ Test(15,"\"One Two\"", new[] { "One Two" });
+ Test(16,"One\" \"Two", new[] { "One Two" });
+ Test(17,"\"One\" \"Two\"", new[] { "One", "Two" });
+ Test(18,"One\\\" Two", new[] { "One\"", "Two" });
+ Test(19,"\\\"One\\\" Two", new[] { "\"One\"", "Two" });
+ Test(20,"\"One", new[] { "One" });
+ Test(21,"One \"\"", new[] { "One", "" });
+ Test(22,"One \"", new[] { "One", "" });
+ Test(23,"1 A=\"B C\"=D 2", new[] { "1", "A=B C=D", "2" });
+ Test(24,"1 A=\"B \\\" C\"=D 2", new[] { "1", "A=B \" C=D", "2" });
+ Test(25,"1 \\A 2", new[] { "1", "\\A", "2" });
+ Test(26,"1 \\\" 2", new[] { "1", "\"", "2" });
+ Test(27,"1 \\\\\" 2", new[] { "1", "\\\"", "2" });
+ Test(28,"\"", new[] { "" });
+ Test(29,"\\\"", new[] { "\"" });
+ Test(30,"'A B'", new[] { "'A", "B'" });
+ Test(31,"^", new[] { "^" });
+ Test(32,"^A", new[] { "A" });
+ Test(33,"^^", new[] { "^" });
+ Test(34,"\\^^", new[] { "\\^" });
+ Test(35,"^\\\\", new[] { "\\\\" });
+ Test(36,"^\"A B\"", new[] { "A B" });
+ Test(37,@"/src:""C:\tmp\Some Folder\Sub Folder"" /users:""abcdefg@hijkl.com"" tasks:""SomeTask,Some Other Task"" -someParam foo", new[] { @"/src:C:\tmp\Some Folder\Sub Folder", @"/users:abcdefg@hijkl.com", @"tasks:SomeTask,Some Other Task", @"-someParam", @"foo" });
+ Test(38,"", new string[] { });
+ Test(39,"a", new[] { "a" });
+ Test(40," abc ", new[] { "abc" });
+ Test(41,"a b ", new[] { "a", "b" });
+ Test(42,"a b \"c d\"", new[] { "a", "b", "c d" });
+ Test(43,"this is a test ", new[] { "this", "is", "a", "test" });
+ Test(44,"this \"is a\" test", new[] { "this", "is a", "test" });
+ Test(45,"\"C:\\Program Files\"", new[] { "C:\\Program Files" });
+ Test(46,"\"He whispered to her \\\"I love you\\\".\"", new[] { "He whispered to her \"I love you\"." });
+ Console.WriteLine("Press a key to continue....");
+ Console.ReadKey();
+ }
+ static void Test(int id,string cmd, string[] r)
+ {
+ string scmd="",sexp="";
+ try
+ {
+ var sr = SplitArgs(cmd).ToArray();
+ scmd = "["+String.Join("][", sr)+"]";
+ sexp = "[" + String.Join("][", r) + "]";
+ if (r.Length != sr.Length)
+ {
+
+ Console.WriteLine($"ERROR:{id}");
+ Console.WriteLine($" cmdline : {cmd}");
+ Console.WriteLine($" splitted: {scmd}");
+ Console.WriteLine($" expected: {sexp}");
+ return;
+ }
+ for (int i = 0; i < r.Length; i++)
+ if (r[i] != sr[i])
+ {
+ Console.WriteLine($"ERROR:{id}");
+ Console.WriteLine($" cmdline : {cmd}");
+ Console.WriteLine($" splitted: {scmd}");
+ Console.WriteLine($" expected: {sexp}");
+ return;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"EXCEP:{id}");
+ Console.WriteLine($" cmdline : {cmd}");
+ Console.WriteLine($" splitted: {scmd}");
+ Console.WriteLine($" expected: {sexp}");
+ return;
+ }
+ }
+ }
+ #endregion CommandLineParser
+}
diff --git a/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Menu.cs b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Menu.cs
new file mode 100644
index 0000000..d6bd869
--- /dev/null
+++ b/Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Menu.cs
@@ -0,0 +1,289 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Threading;
+
+using Microsoft.Web.Administration;
+using System.Management;
+using System.Diagnostics;
+
+using Vrh.XmlProcessing;
+using System.Xml.Linq;
+
+namespace Vrh.Log4Pro.MaintenanceConsole
+{
+ public class Menu
+ {
+ public delegate Object MenuItemExecutorFunc(Object p, Object o);
+ public delegate Object MenuItemDisplayerFunc(Object p, int i);
+ public Menu(string title, string selectionprompt = null) { Title = title; if (!string.IsNullOrWhiteSpace(selectionprompt)) { SelectionPrompt = selectionprompt; } }
+ #region private fields
+ private string title;
+ private string Title { get { return ColorConsole.WideString(title); } set { title = value; } }
+ private MenuItemDisplayerFunc MenuItemDisplayer;
+ private SelectionMode selectionMode = Menu.SelectionMode.Multi;
+ private int HeaderWidth = 9;
+ private string SelectionPrompt = "Make Your selection!";
+ #endregion private fields
+
+ #region public properties
+ public List- MenuItemList { get; private set; } = new List
- ();
+ List MenuKeyList { get { return MenuItemList.Select(x => x.Key).ToList(); } }
+ #endregion public properties
+
+ #region public tools
+ public Menu SetMenuItemDisplayer(MenuItemDisplayerFunc displayer)
+ {
+ MenuItemDisplayer = displayer;
+ return this;
+ }
+ public Menu SetSelectionMode(SelectionMode sm) { selectionMode = sm; return this; }
+ public Menu SetHeaderWidth(int hw) { HeaderWidth= hw; return this; }
+ public Menu AddMenuItem(Item mi)
+ {
+ MenuItemList.Add(mi);
+ if (string.IsNullOrWhiteSpace(mi.Key)) { mi.Key = $"#$KEY{MenuItemList.IndexOf(mi)}"; }
+ return this;
+ }
+ public void ClearMenuItemList() { MenuItemList.Clear(); }
+ public void ExecuteMenu()
+ {
+ try
+ {
+ while (true)
+ {
+ DisplayTitle();
+ DisplayItems();
+ var sr = Select();
+ if (sr.Result == Menu.SelectionResult.Exit) { return; }
+ else if (sr.Result == Menu.SelectionResult.None) { continue; }
+ else if (sr.Result == Menu.SelectionResult.Error) { continue; }
+ Execute(sr.SelectedKeyList);
+ }
+ }
+ catch (Exception ex)
+ {
+ ColorConsole.WriteLine(ex.Message,ConsoleColor.Red);
+ if (ex.InnerException != null) { ColorConsole.WriteLine(ex.InnerException.Message, ConsoleColor.Red); }
+ ColorConsole.WriteLine("Press any key to continue...");
+ }
+ }
+ public void DisplayTitle()
+ {
+ Console.Clear();
+ ColorConsole.WriteLine(Title, ConsoleColor.White);
+ ColorConsole.WriteLine(new string('-', Title.Length));
+ }
+ public void DisplayItems(int columns = 1, int columnlength = 0)
+ {
+ int columncounter = 0;
+ ColorConsole.WriteLine();
+ var i = 1;
+ Console.SetCursorPosition(0, Console.CursorTop);
+ foreach (var menuitem in MenuItemList)
+ {
+ ColorConsole.Write($"[");
+ ColorConsole.Write($"{i}");
+ if (!string.IsNullOrEmpty(menuitem.Key) && !menuitem.Key.StartsWith("#$KEY"))
+ {
+ ColorConsole.Write($":");
+ ColorConsole.Write(menuitem.Key, ConsoleColor.Yellow);
+ }
+ ColorConsole.Write($"]");
+ Console.SetCursorPosition(columnlength * columncounter+HeaderWidth, Console.CursorTop);
+
+ if (!string.IsNullOrEmpty(menuitem.Text))
+ {
+ ColorConsole.Write(menuitem.Text);
+ }
+ if (columns == 1)
+ {
+ if (!string.IsNullOrEmpty(menuitem.Text)) { ColorConsole.WriteLine(); }
+ if (MenuItemDisplayer != null)
+ {
+ for (var li = 0; li < 100; li++)
+ {
+ if (li>0) { ColorConsole.Write(new string(' ',HeaderWidth)); }
+ var str = (string)MenuItemDisplayer(menuitem.Parameters, li);
+ if (string.IsNullOrEmpty(str)) { Console.SetCursorPosition(0, Console.CursorTop); }
+ if (str == null) { break; }
+ }
+ }
+ }
+ else
+ {
+ columncounter++;
+ if (columncounter == columns) { ColorConsole.WriteLine(); columncounter = 0; }
+ else
+ {
+ Console.SetCursorPosition(columnlength * columncounter - 2, Console.CursorTop);
+ ColorConsole.Write(" ");
+ }
+ }
+ i++;
+ }
+ if (columns != 1) { ColorConsole.WriteLine(); }
+ if (selectionMode==SelectionMode.Multi)
+ {
+ ColorConsole.Write("*", ConsoleColor.Red,bracket:"()");ColorConsole.WriteLine(" All");
+ }
+ ColorConsole.Write("EX", ConsoleColor.Red,bracket:"()");ColorConsole.WriteLine(" Exit");
+ }
+ public class Selection
+ {
+ public List SelectedKeyList = null;
+ public SelectionResult Result;
+ public List