Commit 2a636a7841b0d362be2d74a676d5792d7bedbd9a
1 parent
1eff8934
v1.30.0.0
- Unblock files megvalósítása
Showing
10 changed files
with
223 additions
and
169 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - CommandLineParser.cs
| @@ -245,6 +245,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS | @@ -245,6 +245,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.CommandLineParserNS | ||
| 245 | { | 245 | { |
| 246 | public const string CMD_FOLDERS = "-FOLDERS"; | 246 | public const string CMD_FOLDERS = "-FOLDERS"; |
| 247 | public static class FolderClean { public const string KEY = "CLN"; } | 247 | public static class FolderClean { public const string KEY = "CLN"; } |
| 248 | + public static class UnblockFiles { public const string KEY = "UNB"; } | ||
| 248 | } | 249 | } |
| 249 | } | 250 | } |
| 250 | public static class ScheduledTaskManager | 251 | public static class ScheduledTaskManager |
Vrh.Log4Pro.MaintenanceConsole/ConsoleFunction - Menu.cs
| @@ -32,7 +32,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | @@ -32,7 +32,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | ||
| 32 | /// </param> | 32 | /// </param> |
| 33 | /// <returns></returns> | 33 | /// <returns></returns> |
| 34 | public delegate Object MenuItemExecutorFunc(Menu.ExecutorParameter p, Object o); | 34 | public delegate Object MenuItemExecutorFunc(Menu.ExecutorParameter p, Object o); |
| 35 | - public delegate Object MenuItemDisplayerFunc(Object p, int i); | 35 | + public enum MenuItemDisplayerReturnValue { EXIT, NEXTLINE, SAMELINE ,} |
| 36 | + public delegate MenuItemDisplayerReturnValue MenuItemDisplayerFunc(Object p, int i); | ||
| 36 | public delegate void MenuHeaderDisplayerFunc(); | 37 | public delegate void MenuHeaderDisplayerFunc(); |
| 37 | 38 | ||
| 38 | public Menu(string title, string selectionprompt = null) { Title = title; if (!string.IsNullOrWhiteSpace(selectionprompt)) { SelectionPrompt = selectionprompt; } } | 39 | public Menu(string title, string selectionprompt = null) { Title = title; if (!string.IsNullOrWhiteSpace(selectionprompt)) { SelectionPrompt = selectionprompt; } } |
| @@ -261,9 +262,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | @@ -261,9 +262,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MenuNS | ||
| 261 | for (var li = 0; li < 100; li++) | 262 | for (var li = 0; li < 100; li++) |
| 262 | { | 263 | { |
| 263 | if (li > 0) { ColorConsole.Write(new string(' ', MenuItemIndentWidth)); } | 264 | if (li > 0) { ColorConsole.Write(new string(' ', MenuItemIndentWidth)); } |
| 264 | - var str = (string)MenuItemDisplayer.Invoke(menuitem.Parameters, li); | ||
| 265 | - if (string.IsNullOrEmpty(str)) { ColorConsole.SetCursorPosition(0, ColorConsole.CursorTop); } | ||
| 266 | - if (str == null) { break; }//nincs több kiírandó sor | 265 | + Menu.MenuItemDisplayerReturnValue rv = (Menu.MenuItemDisplayerReturnValue)MenuItemDisplayer.Invoke(menuitem.Parameters, li); |
| 266 | + if (rv== Menu.MenuItemDisplayerReturnValue.EXIT || rv == Menu.MenuItemDisplayerReturnValue.SAMELINE) { ColorConsole.SetCursorPosition(0, ColorConsole.CursorTop); } | ||
| 267 | + if (rv == Menu.MenuItemDisplayerReturnValue.EXIT) { break; }//nincs több kiírandó sor | ||
| 267 | } | 268 | } |
| 268 | } | 269 | } |
| 269 | } | 270 | } |
Vrh.Log4Pro.MaintenanceConsole/Manager - BackupPackageManager.cs
| @@ -119,7 +119,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | @@ -119,7 +119,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | ||
| 119 | #endregion private DisplayBackupPackages | 119 | #endregion private DisplayBackupPackages |
| 120 | 120 | ||
| 121 | #region private method: DisplayBackupPackageInfo | 121 | #region private method: DisplayBackupPackageInfo |
| 122 | - private static object DisplayBackupPackageInfo(object obj, int lineix) | 122 | + private static Menu.MenuItemDisplayerReturnValue DisplayBackupPackageInfo(object obj, int lineix) |
| 123 | { | 123 | { |
| 124 | BackupPackage xbp = ((obj as Menu.ExecutorParameter).Parameters as BackupPackage); | 124 | BackupPackage xbp = ((obj as Menu.ExecutorParameter).Parameters as BackupPackage); |
| 125 | BackupPackage bp = (new BackupPackage(xbp)).ResolveNames(null); | 125 | BackupPackage bp = (new BackupPackage(xbp)).ResolveNames(null); |
| @@ -128,13 +128,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | @@ -128,13 +128,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | ||
| 128 | ColorConsole.Write($"{bp.Xml_PackageName}", ConsoleColor.Black, ConsoleColor.White); | 128 | ColorConsole.Write($"{bp.Xml_PackageName}", ConsoleColor.Black, ConsoleColor.White); |
| 129 | ColorConsole.Write($"{bp.Xml_Description}", ConsoleColor.White,prefix:", "); | 129 | ColorConsole.Write($"{bp.Xml_Description}", ConsoleColor.White,prefix:", "); |
| 130 | ColorConsole.WriteLine(""); | 130 | ColorConsole.WriteLine(""); |
| 131 | - return " "; | 131 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 132 | } | 132 | } |
| 133 | if (lineix == 1) | 133 | if (lineix == 1) |
| 134 | { | 134 | { |
| 135 | ColorConsole.Write($"{bp.Xml_PackageFilePath}", ConsoleColor.White, prefix: "Package:"); | 135 | ColorConsole.Write($"{bp.Xml_PackageFilePath}", ConsoleColor.White, prefix: "Package:"); |
| 136 | ColorConsole.WriteLine(""); | 136 | ColorConsole.WriteLine(""); |
| 137 | - return " "; | 137 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 138 | } | 138 | } |
| 139 | if (lineix == 2) | 139 | if (lineix == 2) |
| 140 | { | 140 | { |
| @@ -142,9 +142,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | @@ -142,9 +142,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | ||
| 142 | ColorConsole.Write($"{bp.Xml_ExcludeMaskList}", ConsoleColor.White, prefix: " Excl.mask:"); | 142 | ColorConsole.Write($"{bp.Xml_ExcludeMaskList}", ConsoleColor.White, prefix: " Excl.mask:"); |
| 143 | ColorConsole.Write($"{bp.SizePackageTotal}", ConsoleColor.White, prefix: ", Bytes to include:"); | 143 | ColorConsole.Write($"{bp.SizePackageTotal}", ConsoleColor.White, prefix: ", Bytes to include:"); |
| 144 | ColorConsole.WriteLine(""); | 144 | ColorConsole.WriteLine(""); |
| 145 | - return " "; | 145 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 146 | } | 146 | } |
| 147 | - return null; | 147 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 148 | } | 148 | } |
| 149 | #endregion private method: DisplayBackupPackageInfo | 149 | #endregion private method: DisplayBackupPackageInfo |
| 150 | 150 |
Vrh.Log4Pro.MaintenanceConsole/Manager - FileCleanerManager.cs
| @@ -22,6 +22,9 @@ using Vrh.XmlProcessing; | @@ -22,6 +22,9 @@ using Vrh.XmlProcessing; | ||
| 22 | using VRH.Common; | 22 | using VRH.Common; |
| 23 | using System.Xml.Linq; | 23 | using System.Xml.Linq; |
| 24 | using System.Text.RegularExpressions; | 24 | using System.Text.RegularExpressions; |
| 25 | +using System.Runtime.InteropServices; | ||
| 26 | +using System.Security.Cryptography; | ||
| 27 | +using static System.Net.WebRequestMethods; | ||
| 25 | 28 | ||
| 26 | namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | 29 | namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS |
| 27 | { | 30 | { |
| @@ -41,15 +44,34 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -41,15 +44,34 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 41 | 44 | ||
| 42 | var menufunctions = new Menu("Manage Folders To Clean", "Select the management function!") | 45 | var menufunctions = new Menu("Manage Folders To Clean", "Select the management function!") |
| 43 | .AddMenuItem(new Menu.Item(CLP.Module.FileCleanerManager.Functions.FolderClean.KEY, "Clean folder", FolderClean, ep)) | 46 | .AddMenuItem(new Menu.Item(CLP.Module.FileCleanerManager.Functions.FolderClean.KEY, "Clean folder", FolderClean, ep)) |
| 47 | + .AddMenuItem(new Menu.Item(CLP.Module.FileCleanerManager.Functions.UnblockFiles.KEY, "Unblock files", UnblockFiles, ep)) | ||
| 44 | .SetSelectionMode(Menu.SelectionMode.Single) | 48 | .SetSelectionMode(Menu.SelectionMode.Single) |
| 45 | .SetMenuHeaderDisplayer(FolderToCleanListDisplayer); | 49 | .SetMenuHeaderDisplayer(FolderToCleanListDisplayer); |
| 46 | menufunctions.ExecuteMenu(functionkey); | 50 | menufunctions.ExecuteMenu(functionkey); |
| 47 | return o2; | 51 | return o2; |
| 48 | } | 52 | } |
| 49 | - #endregion Execute | 53 | + #endregion Execute |
| 50 | 54 | ||
| 51 | - #region First level Executors with UI | ||
| 52 | - private static object FolderClean(object parameter, object o) | 55 | + #region First level Executors with UI |
| 56 | + private static object UnblockFiles(object parameter, object o) | ||
| 57 | + { | ||
| 58 | + var config = (parameter as Menu.ExecutorParameter).GetConfig<FileCleanerManagerXmlProcessor>(); | ||
| 59 | + var args = (parameter as Menu.ExecutorParameter).Args; | ||
| 60 | + | ||
| 61 | + var selectedftcindexes = CommandLine.GetCommandLineArgument(args, CLP.Module.FileCleanerManager.Functions.CMD_FOLDERS); | ||
| 62 | + | ||
| 63 | + var menufolders = DisplayFolderMenu(config, $"Select the folder(s) to manage with function '{nameof(UnblockFiles)}'!", silent: true); | ||
| 64 | + | ||
| 65 | + Menu.Selection sr = menufolders.Select(selectedftcindexes); | ||
| 66 | + if (sr.Result == Menu.SelectionResult.Exit) { return o; } | ||
| 67 | + else if (sr.Result == Menu.SelectionResult.None) { return o; } | ||
| 68 | + else if (sr.Result == Menu.SelectionResult.Error) { return o; } | ||
| 69 | + else if (sr.Result == Menu.SelectionResult.Ok) { } | ||
| 70 | + else { } | ||
| 71 | + foreach (var p in sr.SelectedParameterList) { OneFolderClean(p.Parameters as FolderToClean); } | ||
| 72 | + return o; | ||
| 73 | + } | ||
| 74 | + private static object FolderClean(object parameter, object o) | ||
| 53 | { | 75 | { |
| 54 | var config = (parameter as Menu.ExecutorParameter).GetConfig<FileCleanerManagerXmlProcessor>(); | 76 | var config = (parameter as Menu.ExecutorParameter).GetConfig<FileCleanerManagerXmlProcessor>(); |
| 55 | var args = (parameter as Menu.ExecutorParameter).Args; | 77 | var args = (parameter as Menu.ExecutorParameter).Args; |
| @@ -72,7 +94,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -72,7 +94,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 72 | try | 94 | try |
| 73 | { | 95 | { |
| 74 | var di = new DirectoryInfo(ftc.Xml_DirectoryPath); | 96 | var di = new DirectoryInfo(ftc.Xml_DirectoryPath); |
| 75 | - var success = FileCleanerManagerCore.CleanFolderFiles(di, ftc, delete: true); | 97 | + var success = FileCleanerManagerCore.CleanFolderFiles(di, ftc, enableexecute: true); |
| 76 | ColorConsole.WriteLine($"Folder cleaned. Name:{ftc.Xml_DirectoryPath}", ConsoleColor.Green); | 98 | ColorConsole.WriteLine($"Folder cleaned. Name:{ftc.Xml_DirectoryPath}", ConsoleColor.Green); |
| 77 | } | 99 | } |
| 78 | catch (Exception ex) { ColorConsole.WriteLine(ex.MessageNested(), ConsoleColor.Red); } | 100 | catch (Exception ex) { ColorConsole.WriteLine(ex.MessageNested(), ConsoleColor.Red); } |
| @@ -100,7 +122,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -100,7 +122,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 100 | } | 122 | } |
| 101 | #endregion private DisplayFolderMenu | 123 | #endregion private DisplayFolderMenu |
| 102 | #region private method: DisplayFolderInfo | 124 | #region private method: DisplayFolderInfo |
| 103 | - private static object DisplayFolderInfo(object obj, int lineix) | 125 | + private static Menu.MenuItemDisplayerReturnValue DisplayFolderInfo(object obj, int lineix) |
| 104 | { | 126 | { |
| 105 | FolderToClean ws = (obj as Menu.ExecutorParameter).Parameters as FolderToClean; | 127 | FolderToClean ws = (obj as Menu.ExecutorParameter).Parameters as FolderToClean; |
| 106 | if (lineix == 0) | 128 | if (lineix == 0) |
| @@ -108,40 +130,39 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -108,40 +130,39 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 108 | ColorConsole.Write($"{ws.Xml_DirectoryPath}", ConsoleColor.Black, ConsoleColor.White); | 130 | ColorConsole.Write($"{ws.Xml_DirectoryPath}", ConsoleColor.Black, ConsoleColor.White); |
| 109 | var existscolor = ws.FolderExists ? ConsoleColor.Green : ConsoleColor.Red; | 131 | var existscolor = ws.FolderExists ? ConsoleColor.Green : ConsoleColor.Red; |
| 110 | var existstext = ws.FolderExists ? "Exists" : "Missing"; | 132 | var existstext = ws.FolderExists ? "Exists" : "Missing"; |
| 111 | - ColorConsole.WriteLine(existstext, existscolor, bracket: "[]", prefix: " ", suffix: ". "); | ||
| 112 | - return " "; | ||
| 113 | - } | ||
| 114 | - else if (lineix == 1) | ||
| 115 | - { | ||
| 116 | - if (ws.FolderExists) | ||
| 117 | - { | ||
| 118 | - ColorConsole.Write(ws.SizeSelectedBeforeClean.ToString(), ConsoleColor.Yellow, prefix: "Size of filtered files now:"); | ||
| 119 | - ColorConsole.Write(ws.SizeSelectedAfterClean.ToString(), ConsoleColor.Yellow, prefix: ", after cleaning:", suffix: ". "); | ||
| 120 | - ColorConsole.Write(ws.SizeSelectedCleaned.ToString(), ConsoleColor.Red, prefix: "To clean:", suffix: "."); | ||
| 121 | - ColorConsole.WriteLine(" "); | ||
| 122 | - return " "; | ||
| 123 | - } | ||
| 124 | - return ""; | ||
| 125 | - } | ||
| 126 | - else if (lineix == 2) | ||
| 127 | - { | ||
| 128 | - var fc2 = ws.Xml_Recurse ? ConsoleColor.Green : ConsoleColor.Yellow; | ||
| 129 | - ColorConsole.Write($"{ws.Xml_Recurse}", fc2, prefix: "Recurse:", bracket: "[]"); | ||
| 130 | - var fc0 = ws.Xml_RemoveEmptyFolder ? ConsoleColor.Green : ConsoleColor.Yellow; | ||
| 131 | - ColorConsole.Write($"{ws.Xml_RemoveEmptyFolder}", fc0, prefix: ", Remove empty folder:", bracket: "[]"); | ||
| 132 | - ColorConsole.Write(ws.Xml_IncludeMask, ConsoleColor.Yellow, prefix: ", Include mask:"); | ||
| 133 | - ColorConsole.WriteLine(ws.Xml_ExcludeMaskList, ConsoleColor.Yellow, prefix: ", Exclude mask:"); | ||
| 134 | - return " "; | ||
| 135 | - } | ||
| 136 | - else if (lineix == 3) | 133 | + ColorConsole.Write(existstext, existscolor, bracket: "[]", prefix: " ", suffix: ". "); |
| 134 | + if (!ws.FolderExists) { ColorConsole.WriteLine(); return Menu.MenuItemDisplayerReturnValue.EXIT; } | ||
| 135 | + | ||
| 136 | + var operationtext = ws.Xml_OperationUnblockEnable ? "UNBLOCK ONLY" : ws.Xml_OperationDeleteEnable ? "DELETE" : "INFO"; | ||
| 137 | + var operationcolor = ws.Xml_OperationUnblockEnable ? ConsoleColor.Yellow : ws.Xml_OperationDeleteEnable ? ConsoleColor.Red : ConsoleColor.Green; | ||
| 138 | + var removeemptyfoldertext = ws.Xml_RemoveEmptyFolder ? " with remove empty folders" : ""; | ||
| 139 | + ColorConsole.Write(operationtext + removeemptyfoldertext, operationcolor, prefix: "Operation:", bracket: "[]", suffix: ". "); | ||
| 140 | + ColorConsole.Write(ws.SizeSelectedBeforeClean.ToString(), ConsoleColor.Yellow, prefix: "Size of filtered files now:"); | ||
| 141 | + if (ws.Xml_OperationDeleteEnable) | ||
| 142 | + { | ||
| 143 | + ColorConsole.Write(ws.SizeSelectedAfterClean.ToString(), ConsoleColor.Yellow, prefix: ", after cleaning:", suffix: ". "); | ||
| 144 | + ColorConsole.Write(ws.SizeSelectedCleaned.ToString(), ConsoleColor.Red, prefix: "To clean:", suffix: "."); | ||
| 145 | + } | ||
| 146 | + ColorConsole.WriteLine(" "); | ||
| 147 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 148 | + } | ||
| 149 | + else if (lineix == 1) | ||
| 150 | + { | ||
| 151 | + var fc2 = ws.Xml_Recurse ? ConsoleColor.Green : ConsoleColor.Yellow; | ||
| 152 | + ColorConsole.Write($"{ws.Xml_Recurse}", fc2, prefix: "Recurse:", bracket: "[]"); | ||
| 153 | + ColorConsole.Write(ws.Xml_IncludeMask, ConsoleColor.Yellow, prefix: ", Include mask:"); | ||
| 154 | + ColorConsole.WriteLine(ws.Xml_ExcludeMaskList, ConsoleColor.Yellow, prefix: ", Exclude mask:"); | ||
| 155 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 156 | + } | ||
| 157 | + else if (lineix == 2) | ||
| 137 | { | 158 | { |
| 138 | ColorConsole.WriteLine(ws.Xml_IncludeFullpathRegexp, ConsoleColor.Yellow, prefix: "Full path regex:"); | 159 | ColorConsole.WriteLine(ws.Xml_IncludeFullpathRegexp, ConsoleColor.Yellow, prefix: "Full path regex:"); |
| 139 | - return " "; | 160 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 140 | } | 161 | } |
| 141 | else // if (lineix == INDEXBASE) | 162 | else // if (lineix == INDEXBASE) |
| 142 | { | 163 | { |
| 143 | - const int INDEXBASE = 4; // a linex következő indexe kerüljön ide !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 144 | - if (ws.Xml_ConditionList.Count <= lineix - INDEXBASE) { return null; } | 164 | + const int INDEXBASE = 3; // a linex következő indexe kerüljön ide !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 165 | + if (ws.Xml_ConditionList.Count <= lineix - INDEXBASE) { return Menu.MenuItemDisplayerReturnValue.EXIT; } | ||
| 145 | var c = ws.Xml_ConditionList.ElementAt(lineix- INDEXBASE); | 166 | var c = ws.Xml_ConditionList.ElementAt(lineix- INDEXBASE); |
| 146 | if (c != null) | 167 | if (c != null) |
| 147 | { | 168 | { |
| @@ -161,10 +182,10 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -161,10 +182,10 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 161 | ColorConsole.Write(climit.ToString(), ConsoleColor.Yellow, prefix: ", Limit:", suffix: "days"); | 182 | ColorConsole.Write(climit.ToString(), ConsoleColor.Yellow, prefix: ", Limit:", suffix: "days"); |
| 162 | } | 183 | } |
| 163 | ColorConsole.WriteLine(); | 184 | ColorConsole.WriteLine(); |
| 164 | - return " "; | 185 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 165 | } | 186 | } |
| 166 | } | 187 | } |
| 167 | - return null; | 188 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 168 | } | 189 | } |
| 169 | #endregion private method: DisplayFolderInfo | 190 | #endregion private method: DisplayFolderInfo |
| 170 | #region private CollectFolderInfo | 191 | #region private CollectFolderInfo |
| @@ -179,7 +200,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -179,7 +200,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 179 | var di = new DirectoryInfo(ftc.Xml_DirectoryPath); | 200 | var di = new DirectoryInfo(ftc.Xml_DirectoryPath); |
| 180 | ftc.SizeFolderTotal = FileCleanerManagerCore.DirSize(di,"*","","",ftc.Xml_Recurse); | 201 | ftc.SizeFolderTotal = FileCleanerManagerCore.DirSize(di,"*","","",ftc.Xml_Recurse); |
| 181 | ftc.SizeSelectedBeforeClean = FileCleanerManagerCore.DirSize(di, ftc.Xml_IncludeMask,ftc.Xml_ExcludeMaskList, ftc.Xml_IncludeFullpathRegexp, ftc.Xml_Recurse); | 202 | ftc.SizeSelectedBeforeClean = FileCleanerManagerCore.DirSize(di, ftc.Xml_IncludeMask,ftc.Xml_ExcludeMaskList, ftc.Xml_IncludeFullpathRegexp, ftc.Xml_Recurse); |
| 182 | - ftc.SizeSelectedCleaned = FileCleanerManagerCore.CleanFolderFiles(di,ftc,delete:false); | 203 | + ftc.SizeSelectedCleaned = FileCleanerManagerCore.CleanFolderFiles(di,ftc,enableexecute:false); |
| 183 | } | 204 | } |
| 184 | return ftc; | 205 | return ftc; |
| 185 | } | 206 | } |
| @@ -287,9 +308,25 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -287,9 +308,25 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 287 | } | 308 | } |
| 288 | return false; | 309 | return false; |
| 289 | } | 310 | } |
| 290 | - #endregion public FileIsToDelete | ||
| 291 | - #region public CleanFiles | ||
| 292 | - public static long CleanFolderFiles(DirectoryInfo d,FolderToClean ftc, bool delete) | 311 | + #endregion public FileIsToDelete |
| 312 | + #region public UnblockMany,UnblockOne | ||
| 313 | + [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)] | ||
| 314 | + [return: MarshalAs(UnmanagedType.Bool)] | ||
| 315 | + private static extern bool DeleteFile(string name); | ||
| 316 | + | ||
| 317 | + public static bool UnblockOne(string fileName) | ||
| 318 | + { | ||
| 319 | + return DeleteFile(fileName + ":Zone.Identifier"); | ||
| 320 | + } | ||
| 321 | + public static void UnblockMany(string path, string pattern) | ||
| 322 | + { | ||
| 323 | + var fullmask = Path.Combine(path, pattern); | ||
| 324 | + string[] files = Directory.GetFiles(path, pattern, SearchOption.AllDirectories); | ||
| 325 | + foreach (string file in files) { UnblockOne(file); } | ||
| 326 | + } | ||
| 327 | + #endregion public UnblockMany,UnblockOne | ||
| 328 | + #region public CleanFolderFiles | ||
| 329 | + public static long CleanFolderFiles(DirectoryInfo d,FolderToClean ftc, bool enableexecute) | ||
| 293 | { | 330 | { |
| 294 | long cleanedsize = 0; | 331 | long cleanedsize = 0; |
| 295 | // Add file sizes. | 332 | // Add file sizes. |
| @@ -302,8 +339,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -302,8 +339,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 302 | try | 339 | try |
| 303 | { | 340 | { |
| 304 | if (Regex.Match(fi.Name, ZipTools.FileNameMaskListToRegex(ftc.Xml_ExcludeMaskList)).Success) continue; | 341 | if (Regex.Match(fi.Name, ZipTools.FileNameMaskListToRegex(ftc.Xml_ExcludeMaskList)).Success) continue; |
| 305 | - if (delete) { File.Delete(fi.FullName); } | ||
| 306 | - cleanedsize += fl; | 342 | + if (enableexecute) |
| 343 | + { | ||
| 344 | + if (ftc.Xml_OperationUnblockEnable) { UnblockOne(fi.FullName); } | ||
| 345 | + else if (ftc.Xml_OperationDeleteEnable) { System.IO.File.Delete(fi.FullName); } | ||
| 346 | + ColorConsole.Write(fi.FullName); ColorConsole.SetCursorPosition(0, ColorConsole.CursorTop); | ||
| 347 | + } | ||
| 348 | + cleanedsize += fl; | ||
| 307 | } | 349 | } |
| 308 | catch { } | 350 | catch { } |
| 309 | } | 351 | } |
| @@ -311,7 +353,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -311,7 +353,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 311 | // Add subdirectory sizes. | 353 | // Add subdirectory sizes. |
| 312 | if (ftc.Xml_Recurse) | 354 | if (ftc.Xml_Recurse) |
| 313 | { | 355 | { |
| 314 | - foreach (DirectoryInfo di in d.GetDirectories()) { cleanedsize += CleanFolderFiles(di, ftc, delete); } | 356 | + foreach (DirectoryInfo di in d.GetDirectories()) { cleanedsize += /*recursion*/ CleanFolderFiles(di, ftc, enableexecute); } |
| 315 | } | 357 | } |
| 316 | if (ftc.Xml_RemoveEmptyFolder && IsDirectoryEmpty(d)) | 358 | if (ftc.Xml_RemoveEmptyFolder && IsDirectoryEmpty(d)) |
| 317 | { | 359 | { |
| @@ -319,12 +361,12 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -319,12 +361,12 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 319 | } | 361 | } |
| 320 | return cleanedsize; | 362 | return cleanedsize; |
| 321 | } | 363 | } |
| 322 | - #endregion public CleanFiles | ||
| 323 | - } | ||
| 324 | - #endregion class FileCleanerManagerCore | 364 | + #endregion public CleanFolderFiles |
| 365 | + } | ||
| 366 | + #endregion class FileCleanerManagerCore | ||
| 325 | 367 | ||
| 326 | - #region FileCleanerManagerCoreXmlProcessor class | ||
| 327 | - public class FileCleanerManagerXmlProcessor : XmlParser | 368 | + #region FileCleanerManagerCoreXmlProcessor class |
| 369 | + public class FileCleanerManagerXmlProcessor : XmlParser | ||
| 328 | { | 370 | { |
| 329 | private List<FolderToClean> _foldertocleanlist; | 371 | private List<FolderToClean> _foldertocleanlist; |
| 330 | #region constructor | 372 | #region constructor |
| @@ -370,7 +412,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -370,7 +412,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 370 | public string Xml_Key; | 412 | public string Xml_Key; |
| 371 | public string Xml_DirectoryPath; | 413 | public string Xml_DirectoryPath; |
| 372 | public bool Xml_Recurse; | 414 | public bool Xml_Recurse; |
| 373 | - public bool Xml_RemoveEmptyFolder; | 415 | + public bool Xml_OperationUnblockEnable; |
| 416 | + public bool Xml_OperationDeleteEnable; | ||
| 417 | + public bool Xml_RemoveEmptyFolder; | ||
| 374 | public string Xml_IncludeMask; | 418 | public string Xml_IncludeMask; |
| 375 | public string Xml_ExcludeMaskList; | 419 | public string Xml_ExcludeMaskList; |
| 376 | public string Xml_IncludeFullpathRegexp; | 420 | public string Xml_IncludeFullpathRegexp; |
| @@ -404,8 +448,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -404,8 +448,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 404 | Xml_DirectoryPath = foldertocleanxml.Attribute(XName.Get(nameof(XmlStructure.FolderToClean.Attributes.Directory)))?.Value; | 448 | Xml_DirectoryPath = foldertocleanxml.Attribute(XName.Get(nameof(XmlStructure.FolderToClean.Attributes.Directory)))?.Value; |
| 405 | if (string.IsNullOrWhiteSpace(Xml_DirectoryPath)) { throw new ApplicationException(string.Format(ATTRIBUTEMANDATORY, nameof(XmlStructure.FolderToClean.Attributes.Directory))); } | 449 | if (string.IsNullOrWhiteSpace(Xml_DirectoryPath)) { throw new ApplicationException(string.Format(ATTRIBUTEMANDATORY, nameof(XmlStructure.FolderToClean.Attributes.Directory))); } |
| 406 | Xml_Recurse = GetValue(nameof(XmlStructure.FolderToClean.Attributes.Recurse), foldertocleanxml, XmlStructure.FolderToClean.Attributes.Recurse.Values.DEFAULT); | 450 | Xml_Recurse = GetValue(nameof(XmlStructure.FolderToClean.Attributes.Recurse), foldertocleanxml, XmlStructure.FolderToClean.Attributes.Recurse.Values.DEFAULT); |
| 451 | + Xml_OperationDeleteEnable= GetValue(nameof(XmlStructure.FolderToClean.Attributes.Delete), foldertocleanxml, XmlStructure.FolderToClean.Attributes.Delete.Values.DEFAULT); | ||
| 452 | + Xml_OperationUnblockEnable= GetValue(nameof(XmlStructure.FolderToClean.Attributes.UnblockOnly), foldertocleanxml, XmlStructure.FolderToClean.Attributes.UnblockOnly.Values.DEFAULT); | ||
| 407 | Xml_RemoveEmptyFolder = GetValue(nameof(XmlStructure.FolderToClean.Attributes.RemoveEmptyFolder), foldertocleanxml, XmlStructure.FolderToClean.Attributes.RemoveEmptyFolder.Values.DEFAULT); | 453 | Xml_RemoveEmptyFolder = GetValue(nameof(XmlStructure.FolderToClean.Attributes.RemoveEmptyFolder), foldertocleanxml, XmlStructure.FolderToClean.Attributes.RemoveEmptyFolder.Values.DEFAULT); |
| 408 | - Xml_IncludeMask = GetValue(nameof(XmlStructure.FolderToClean.Attributes.IncludeMask), foldertocleanxml, XmlStructure.FolderToClean.Attributes.IncludeMask.Values.DEFAULT); | 454 | + Xml_RemoveEmptyFolder = Xml_RemoveEmptyFolder && Xml_OperationDeleteEnable; |
| 455 | + Xml_IncludeMask = GetValue(nameof(XmlStructure.FolderToClean.Attributes.IncludeMask), foldertocleanxml, XmlStructure.FolderToClean.Attributes.IncludeMask.Values.DEFAULT); | ||
| 409 | Xml_ExcludeMaskList = GetValue(nameof(XmlStructure.FolderToClean.Attributes.ExcludeMaskList), foldertocleanxml, XmlStructure.FolderToClean.Attributes.ExcludeMaskList.Values.DEFAULT); | 456 | Xml_ExcludeMaskList = GetValue(nameof(XmlStructure.FolderToClean.Attributes.ExcludeMaskList), foldertocleanxml, XmlStructure.FolderToClean.Attributes.ExcludeMaskList.Values.DEFAULT); |
| 410 | Xml_IncludeFullpathRegexp = GetValue(GetXElement(foldertocleanxml,nameof(XmlStructure.FolderToClean.IncludeFullpathRegexp)), XmlStructure.FolderToClean.IncludeFullpathRegexp.Values.DEFAULT); | 457 | Xml_IncludeFullpathRegexp = GetValue(GetXElement(foldertocleanxml,nameof(XmlStructure.FolderToClean.IncludeFullpathRegexp)), XmlStructure.FolderToClean.IncludeFullpathRegexp.Values.DEFAULT); |
| 411 | Xml_IncludeFullpathRegexp = Xml_IncludeFullpathRegexp.Replace("{DTSREGEX}", commondatetimestampregex).Replace("{TSREGEX}", commontimestampregex).Replace("{DSREGEX}", commondatestampregex); | 458 | Xml_IncludeFullpathRegexp = Xml_IncludeFullpathRegexp.Replace("{DTSREGEX}", commondatetimestampregex).Replace("{TSREGEX}", commontimestampregex).Replace("{DSREGEX}", commondatestampregex); |
| @@ -491,7 +538,21 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | @@ -491,7 +538,21 @@ namespace Vrh.Log4Pro.MaintenanceConsole.FileCleanerManagerNS | ||
| 491 | public static class Key { public static class Values { public const string DEFAULT = ""; } } | 538 | public static class Key { public static class Values { public const string DEFAULT = ""; } } |
| 492 | public static class Directory { } | 539 | public static class Directory { } |
| 493 | public static class LimitDays { public static class Values { public const int DEFAULT = XmlStructure.CommonAttributes.Attributes.LimitDays.Values.DEFAULT; } } | 540 | public static class LimitDays { public static class Values { public const int DEFAULT = XmlStructure.CommonAttributes.Attributes.LimitDays.Values.DEFAULT; } } |
| 494 | - public static class Recurse | 541 | + public static class Delete |
| 542 | + { | ||
| 543 | + public static class Values | ||
| 544 | + { | ||
| 545 | + public const bool DEFAULT = false; | ||
| 546 | + } | ||
| 547 | + } | ||
| 548 | + public static class UnblockOnly | ||
| 549 | + { | ||
| 550 | + public static class Values | ||
| 551 | + { | ||
| 552 | + public const bool DEFAULT = false; | ||
| 553 | + } | ||
| 554 | + } | ||
| 555 | + public static class Recurse | ||
| 495 | { | 556 | { |
| 496 | public static class Values | 557 | public static class Values |
| 497 | { | 558 | { |
Vrh.Log4Pro.MaintenanceConsole/Manager - MSMQManager.cs
| @@ -615,12 +615,12 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -615,12 +615,12 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 615 | } | 615 | } |
| 616 | #endregion private DisplayTasks | 616 | #endregion private DisplayTasks |
| 617 | #region private method: DisplayTaskInfo | 617 | #region private method: DisplayTaskInfo |
| 618 | - private static object DisplayMSMQInfo(object obj, int lineix) | 618 | + private static Menu.MenuItemDisplayerReturnValue DisplayMSMQInfo(object obj, int lineix) |
| 619 | { | 619 | { |
| 620 | MSMQ st = (obj as Menu.ExecutorParameter).Parameters as MSMQ; | 620 | MSMQ st = (obj as Menu.ExecutorParameter).Parameters as MSMQ; |
| 621 | return st.DisplayShortInfo(lineix); | 621 | return st.DisplayShortInfo(lineix); |
| 622 | } | 622 | } |
| 623 | - private static object DisplayMSMQShortInfo(object obj, int lineix) | 623 | + private static Menu.MenuItemDisplayerReturnValue DisplayMSMQShortInfo(object obj, int lineix) |
| 624 | { | 624 | { |
| 625 | MSMQ st = (obj as Menu.ExecutorParameter).Parameters as MSMQ; | 625 | MSMQ st = (obj as Menu.ExecutorParameter).Parameters as MSMQ; |
| 626 | return st.DisplayVeryShortInfo(lineix); | 626 | return st.DisplayVeryShortInfo(lineix); |
| @@ -1247,7 +1247,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -1247,7 +1247,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 1247 | } | 1247 | } |
| 1248 | #endregion CollectMSMQInfo | 1248 | #endregion CollectMSMQInfo |
| 1249 | 1249 | ||
| 1250 | - public string DisplayVeryShortInfo(int lineix) | 1250 | + public Menu.MenuItemDisplayerReturnValue DisplayVeryShortInfo(int lineix) |
| 1251 | { | 1251 | { |
| 1252 | MSMQ msmq = this; | 1252 | MSMQ msmq = this; |
| 1253 | if (lineix == 0) | 1253 | if (lineix == 0) |
| @@ -1261,7 +1261,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -1261,7 +1261,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 1261 | else { statuscolor = ConsoleColor.Red; } | 1261 | else { statuscolor = ConsoleColor.Red; } |
| 1262 | ColorConsole.Write(msmq.Status, statuscolor, bracket: "[]", prefix: " ", suffix: ". "); | 1262 | ColorConsole.Write(msmq.Status, statuscolor, bracket: "[]", prefix: " ", suffix: ". "); |
| 1263 | ColorConsole.WriteLine(); | 1263 | ColorConsole.WriteLine(); |
| 1264 | - return " "; | 1264 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1265 | } | 1265 | } |
| 1266 | else if (lineix == 1) | 1266 | else if (lineix == 1) |
| 1267 | { | 1267 | { |
| @@ -1269,11 +1269,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -1269,11 +1269,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 1269 | ColorConsole.Write($"{msmq.Xml_AddressPrefix}", ConsoleColor.Black, ConsoleColor.White, prefix: "Format:", suffix: $" Queue is { privatepublictext }."); | 1269 | ColorConsole.Write($"{msmq.Xml_AddressPrefix}", ConsoleColor.Black, ConsoleColor.White, prefix: "Format:", suffix: $" Queue is { privatepublictext }."); |
| 1270 | ColorConsole.Write($"{msmq.Xml_Server}", ConsoleColor.Black, ConsoleColor.White, prefix: "Server:"); | 1270 | ColorConsole.Write($"{msmq.Xml_Server}", ConsoleColor.Black, ConsoleColor.White, prefix: "Server:"); |
| 1271 | ColorConsole.WriteLine(); | 1271 | ColorConsole.WriteLine(); |
| 1272 | - return " "; | 1272 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1273 | } | 1273 | } |
| 1274 | - return null; | 1274 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 1275 | } | 1275 | } |
| 1276 | - public string DisplayShortInfo(int lineix) | 1276 | + public Menu.MenuItemDisplayerReturnValue DisplayShortInfo(int lineix) |
| 1277 | { | 1277 | { |
| 1278 | MSMQ msmq = this; | 1278 | MSMQ msmq = this; |
| 1279 | if (lineix == 0) | 1279 | if (lineix == 0) |
| @@ -1287,7 +1287,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -1287,7 +1287,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 1287 | else { statuscolor = ConsoleColor.Red; } | 1287 | else { statuscolor = ConsoleColor.Red; } |
| 1288 | ColorConsole.Write(msmq.Status, statuscolor, bracket: "[]", prefix: " ", suffix: ". "); | 1288 | ColorConsole.Write(msmq.Status, statuscolor, bracket: "[]", prefix: " ", suffix: ". "); |
| 1289 | ColorConsole.WriteLine(); | 1289 | ColorConsole.WriteLine(); |
| 1290 | - return " "; | 1290 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1291 | } | 1291 | } |
| 1292 | else if (lineix == 1) | 1292 | else if (lineix == 1) |
| 1293 | { | 1293 | { |
| @@ -1295,71 +1295,56 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | @@ -1295,71 +1295,56 @@ namespace Vrh.Log4Pro.MaintenanceConsole.MSMQManagerNS | ||
| 1295 | ColorConsole.Write($"{msmq.Xml_AddressPrefix}", ConsoleColor.Black, ConsoleColor.White, prefix: "Format:", suffix: $" Queue is { privatepublictext }."); | 1295 | ColorConsole.Write($"{msmq.Xml_AddressPrefix}", ConsoleColor.Black, ConsoleColor.White, prefix: "Format:", suffix: $" Queue is { privatepublictext }."); |
| 1296 | ColorConsole.Write($"{msmq.Xml_Server}", ConsoleColor.Black, ConsoleColor.White, prefix: "Server:", suffix: $" Queue is { privatepublictext }."); | 1296 | ColorConsole.Write($"{msmq.Xml_Server}", ConsoleColor.Black, ConsoleColor.White, prefix: "Server:", suffix: $" Queue is { privatepublictext }."); |
| 1297 | ColorConsole.WriteLine(); | 1297 | ColorConsole.WriteLine(); |
| 1298 | - return " "; | 1298 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1299 | } | 1299 | } |
| 1300 | else if (lineix == 2) | 1300 | else if (lineix == 2) |
| 1301 | { | 1301 | { |
| 1302 | ColorConsole.Write($"{msmq.Path}", ConsoleColor.Yellow, prefix: "Path ", suffix: ", "); | 1302 | ColorConsole.Write($"{msmq.Path}", ConsoleColor.Yellow, prefix: "Path ", suffix: ", "); |
| 1303 | ColorConsole.WriteLine(); | 1303 | ColorConsole.WriteLine(); |
| 1304 | - return " "; | 1304 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1305 | } | 1305 | } |
| 1306 | else if (lineix == 3) | 1306 | else if (lineix == 3) |
| 1307 | { | 1307 | { |
| 1308 | - if (msmq.StatusDescription != null) | ||
| 1309 | - { | ||
| 1310 | - ConsoleColor color = ConsoleColor.Yellow; | ||
| 1311 | - if (msmq.Status == "Ready") { color = ConsoleColor.Green; } | ||
| 1312 | - else if (msmq.Status == "Error") { color = ConsoleColor.Red; } | ||
| 1313 | - ColorConsole.Write($"{msmq.StatusDescription}", color, prefix: "Status description "); | ||
| 1314 | - ColorConsole.WriteLine(); | ||
| 1315 | - return " "; | ||
| 1316 | - } | ||
| 1317 | - return "";//empty=van még szöveg, de most nem történt kiírás | ||
| 1318 | - } | ||
| 1319 | - else if (lineix == 4) | 1308 | + if (msmq.StatusDescription == null) return Menu.MenuItemDisplayerReturnValue.SAMELINE;//empty=van még szöveg, de most nem történt kiírás |
| 1309 | + ConsoleColor color = ConsoleColor.Yellow; | ||
| 1310 | + if (msmq.Status == "Ready") { color = ConsoleColor.Green; } | ||
| 1311 | + else if (msmq.Status == "Error") { color = ConsoleColor.Red; } | ||
| 1312 | + ColorConsole.Write($"{msmq.StatusDescription}", color, prefix: "Status description "); | ||
| 1313 | + ColorConsole.WriteLine(); | ||
| 1314 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 1315 | + } | ||
| 1316 | + else if (lineix == 4) | ||
| 1320 | { | 1317 | { |
| 1321 | - if (msmq.Status == "Ready") | ||
| 1322 | - { | ||
| 1323 | - ColorConsole.Write($"{msmq.FormatName}", ConsoleColor.Yellow, prefix: "FormatName "); | ||
| 1324 | - ColorConsole.WriteLine(); | ||
| 1325 | - return " "; | ||
| 1326 | - } | ||
| 1327 | - return ""; | ||
| 1328 | - } | ||
| 1329 | - else if (lineix == 5) | 1318 | + if (msmq.Status != "Ready") return Menu.MenuItemDisplayerReturnValue.SAMELINE; |
| 1319 | + ColorConsole.Write($"{msmq.FormatName}", ConsoleColor.Yellow, prefix: "FormatName "); | ||
| 1320 | + ColorConsole.WriteLine(); | ||
| 1321 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 1322 | + } | ||
| 1323 | + else if (lineix == 5) | ||
| 1330 | { | 1324 | { |
| 1331 | - if (msmq.Status == "Ready") | ||
| 1332 | - { | ||
| 1333 | - ColorConsole.Write($"{msmq.Id}", ConsoleColor.Yellow, prefix: "Id "); | ||
| 1334 | - ColorConsole.WriteLine(); | ||
| 1335 | - return " "; | ||
| 1336 | - } | ||
| 1337 | - return ""; | ||
| 1338 | - } | ||
| 1339 | - else if (lineix == 6) | 1325 | + if (msmq.Status != "Ready") return Menu.MenuItemDisplayerReturnValue.SAMELINE; |
| 1326 | + ColorConsole.Write($"{msmq.Id}", ConsoleColor.Yellow, prefix: "Id "); | ||
| 1327 | + ColorConsole.WriteLine(); | ||
| 1328 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 1329 | + } | ||
| 1330 | + else if (lineix == 6) | ||
| 1340 | { | 1331 | { |
| 1341 | - if (msmq.Status == "Ready") | ||
| 1342 | - { | ||
| 1343 | - ColorConsole.Write(msmq.NumOfMessages.ToString(), ConsoleColor.Yellow, prefix: "Num.of msgs in queue ", suffix: ". "); | ||
| 1344 | - ColorConsole.Write($"{msmq.LastModifyTime}", ConsoleColor.Yellow, prefix: "LastModified ", suffix: ", "); | ||
| 1345 | - ColorConsole.WriteLine(); | ||
| 1346 | - return " "; | ||
| 1347 | - } | ||
| 1348 | - return ""; | ||
| 1349 | - } | ||
| 1350 | - else if (lineix == 7) | 1332 | + if (msmq.Status != "Ready") return Menu.MenuItemDisplayerReturnValue.SAMELINE; |
| 1333 | + ColorConsole.Write(msmq.NumOfMessages.ToString(), ConsoleColor.Yellow, prefix: "Num.of msgs in queue ", suffix: ". "); | ||
| 1334 | + ColorConsole.Write($"{msmq.LastModifyTime}", ConsoleColor.Yellow, prefix: "LastModified ", suffix: ", "); | ||
| 1335 | + ColorConsole.WriteLine(); | ||
| 1336 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 1337 | + } | ||
| 1338 | + else if (lineix == 7) | ||
| 1351 | { | 1339 | { |
| 1352 | - if (msmq.Status == "Ready") | ||
| 1353 | - { | ||
| 1354 | - ColorConsole.Write($"{msmq.AccessMode}", ConsoleColor.Yellow, prefix: "AccessMode ", suffix: ", "); | ||
| 1355 | - ColorConsole.Write($"{msmq.CanRead}", ConsoleColor.Yellow, prefix: "CanRead ", suffix: ", "); | ||
| 1356 | - ColorConsole.Write($"{msmq.CanWrite}", ConsoleColor.Yellow, prefix: "CanWrite ", suffix: ", "); | ||
| 1357 | - ColorConsole.WriteLine(); | ||
| 1358 | - return " "; | ||
| 1359 | - } | ||
| 1360 | - return ""; | ||
| 1361 | - } | ||
| 1362 | - return null; | 1340 | + if (msmq.Status == "Ready") return Menu.MenuItemDisplayerReturnValue.SAMELINE; |
| 1341 | + ColorConsole.Write($"{msmq.AccessMode}", ConsoleColor.Yellow, prefix: "AccessMode ", suffix: ", "); | ||
| 1342 | + ColorConsole.Write($"{msmq.CanRead}", ConsoleColor.Yellow, prefix: "CanRead ", suffix: ", "); | ||
| 1343 | + ColorConsole.Write($"{msmq.CanWrite}", ConsoleColor.Yellow, prefix: "CanWrite ", suffix: ", "); | ||
| 1344 | + ColorConsole.WriteLine(); | ||
| 1345 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; | ||
| 1346 | + } | ||
| 1347 | + return Menu.MenuItemDisplayerReturnValue.EXIT; | ||
| 1363 | } | 1348 | } |
| 1364 | 1349 | ||
| 1365 | #region DisplayInfo | 1350 | #region DisplayInfo |
Vrh.Log4Pro.MaintenanceConsole/Manager - SQLDataBaseManager.cs
| @@ -1208,7 +1208,7 @@ GO | @@ -1208,7 +1208,7 @@ GO | ||
| 1208 | } | 1208 | } |
| 1209 | #endregion private DisplaySQLDataBaseMenu | 1209 | #endregion private DisplaySQLDataBaseMenu |
| 1210 | #region private method: DisplayDataBaseInfo | 1210 | #region private method: DisplayDataBaseInfo |
| 1211 | - private static object DisplayDataBaseInfo(object obj, int lineix) | 1211 | + private static Menu.MenuItemDisplayerReturnValue DisplayDataBaseInfo(object obj, int lineix) |
| 1212 | { | 1212 | { |
| 1213 | SQLDataBase st = (obj as Menu.ExecutorParameter).Parameters as SQLDataBase; | 1213 | SQLDataBase st = (obj as Menu.ExecutorParameter).Parameters as SQLDataBase; |
| 1214 | //SQLDataBaseManagerCore.GetPhysicalFilesLocationAndSize(st.SQLCS,out string dbsizetext,out string dbpathtext); | 1214 | //SQLDataBaseManagerCore.GetPhysicalFilesLocationAndSize(st.SQLCS,out string dbsizetext,out string dbpathtext); |
| @@ -1224,44 +1224,44 @@ GO | @@ -1224,44 +1224,44 @@ GO | ||
| 1224 | } | 1224 | } |
| 1225 | if (st.Xml_IsRemoteDB) { ColorConsole.Write("REMOTE", ConsoleColor.Cyan, bracket: "[]", prefix: "", suffix: ""); } | 1225 | if (st.Xml_IsRemoteDB) { ColorConsole.Write("REMOTE", ConsoleColor.Cyan, bracket: "[]", prefix: "", suffix: ""); } |
| 1226 | ColorConsole.WriteLine(); | 1226 | ColorConsole.WriteLine(); |
| 1227 | - return " "; | 1227 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1228 | } | 1228 | } |
| 1229 | else if (lineix == 1) | 1229 | else if (lineix == 1) |
| 1230 | { | 1230 | { |
| 1231 | ColorConsole.Write($"{st.Xml_BackupFileNameMask}", ConsoleColor.Yellow, prefix: "Backup to:", suffix: ".xxx"); | 1231 | ColorConsole.Write($"{st.Xml_BackupFileNameMask}", ConsoleColor.Yellow, prefix: "Backup to:", suffix: ".xxx"); |
| 1232 | ColorConsole.WriteLine(); | 1232 | ColorConsole.WriteLine(); |
| 1233 | - return ""; | 1233 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1234 | } | 1234 | } |
| 1235 | else if (lineix == 2) | 1235 | else if (lineix == 2) |
| 1236 | { | 1236 | { |
| 1237 | ColorConsole.Write($"{st.SQLCS}", ConsoleColor.Yellow, prefix: "SQL DB connection:", suffix: ", "); | 1237 | ColorConsole.Write($"{st.SQLCS}", ConsoleColor.Yellow, prefix: "SQL DB connection:", suffix: ", "); |
| 1238 | ColorConsole.WriteLine(" "); | 1238 | ColorConsole.WriteLine(" "); |
| 1239 | - return " "; | 1239 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1240 | } | 1240 | } |
| 1241 | else if (lineix == 3) | 1241 | else if (lineix == 3) |
| 1242 | { | 1242 | { |
| 1243 | var PhysicalFilesDirectoryPathcolor = st.PhysicalFilesDirectoryPath.StartsWith("ERR") ? ConsoleColor.Red : ConsoleColor.Yellow; | 1243 | var PhysicalFilesDirectoryPathcolor = st.PhysicalFilesDirectoryPath.StartsWith("ERR") ? ConsoleColor.Red : ConsoleColor.Yellow; |
| 1244 | ColorConsole.Write($"{st.PhysicalFilesDirectoryPath}", PhysicalFilesDirectoryPathcolor, prefix: "DB files physical location:", suffix: " "); | 1244 | ColorConsole.Write($"{st.PhysicalFilesDirectoryPath}", PhysicalFilesDirectoryPathcolor, prefix: "DB files physical location:", suffix: " "); |
| 1245 | ColorConsole.WriteLine(" "); | 1245 | ColorConsole.WriteLine(" "); |
| 1246 | - return " "; | 1246 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1247 | } | 1247 | } |
| 1248 | else if (lineix == 4) | 1248 | else if (lineix == 4) |
| 1249 | { | 1249 | { |
| 1250 | var SizeStringcolor = st.SizeString.StartsWith("ERR") ? ConsoleColor.Red : ConsoleColor.Yellow; | 1250 | var SizeStringcolor = st.SizeString.StartsWith("ERR") ? ConsoleColor.Red : ConsoleColor.Yellow; |
| 1251 | ColorConsole.Write(st.SizeString, SizeStringcolor, prefix: "DB size:", suffix: " "); | 1251 | ColorConsole.Write(st.SizeString, SizeStringcolor, prefix: "DB size:", suffix: " "); |
| 1252 | ColorConsole.WriteLine(" "); | 1252 | ColorConsole.WriteLine(" "); |
| 1253 | - return " "; | 1253 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1254 | } | 1254 | } |
| 1255 | else if (5 <= lineix && lineix <= 5 + st.Xml_SQLScriptList.Count) | 1255 | else if (5 <= lineix && lineix <= 5 + st.Xml_SQLScriptList.Count) |
| 1256 | { | 1256 | { |
| 1257 | - if (st.Xml_SQLScriptList.Count == 0) { return null; } | ||
| 1258 | - if (st.Xml_SQLScriptList.Count-1 < lineix-5) { return null; } | 1257 | + if (st.Xml_SQLScriptList.Count == 0) { return Menu.MenuItemDisplayerReturnValue.EXIT; } |
| 1258 | + if (st.Xml_SQLScriptList.Count-1 < lineix-5) { return Menu.MenuItemDisplayerReturnValue.EXIT; } | ||
| 1259 | var s = st.Xml_SQLScriptList.ToArray()[lineix-5]; | 1259 | var s = st.Xml_SQLScriptList.ToArray()[lineix-5]; |
| 1260 | ColorConsole.Write(s.Key, ConsoleColor.Yellow, bracket: "[]", suffix: " ", prefix: " Script: "); | 1260 | ColorConsole.Write(s.Key, ConsoleColor.Yellow, bracket: "[]", suffix: " ", prefix: " Script: "); |
| 1261 | ColorConsole.WriteLine($"{s.Description} ({s.Name})", ConsoleColor.Yellow); | 1261 | ColorConsole.WriteLine($"{s.Description} ({s.Name})", ConsoleColor.Yellow); |
| 1262 | - return " "; | 1262 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 1263 | } | 1263 | } |
| 1264 | - return null; | 1264 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 1265 | } | 1265 | } |
| 1266 | #endregion private method: DisplayDataBaseInfo | 1266 | #endregion private method: DisplayDataBaseInfo |
| 1267 | #endregion private methods | 1267 | #endregion private methods |
Vrh.Log4Pro.MaintenanceConsole/Manager - ScheduledTaskManager.cs
| @@ -272,7 +272,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS | @@ -272,7 +272,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS | ||
| 272 | } | 272 | } |
| 273 | #endregion private DisplayTasks | 273 | #endregion private DisplayTasks |
| 274 | #region private method: DisplayTaskInfo | 274 | #region private method: DisplayTaskInfo |
| 275 | - private static object DisplayTaskInfo(object obj, int lineix) | 275 | + private static Menu.MenuItemDisplayerReturnValue DisplayTaskInfo(object obj, int lineix) |
| 276 | { | 276 | { |
| 277 | ScheduledTask st = (obj as Menu.ExecutorParameter).Parameters as ScheduledTask; | 277 | ScheduledTask st = (obj as Menu.ExecutorParameter).Parameters as ScheduledTask; |
| 278 | if (lineix == 0) | 278 | if (lineix == 0) |
| @@ -285,7 +285,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS | @@ -285,7 +285,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS | ||
| 285 | ColorConsole.Write(st.PriorityText(st.Priority), statuscolor, prefix: "Effective priority ", suffix: ". "); | 285 | ColorConsole.Write(st.PriorityText(st.Priority), statuscolor, prefix: "Effective priority ", suffix: ". "); |
| 286 | } | 286 | } |
| 287 | ColorConsole.WriteLine(); | 287 | ColorConsole.WriteLine(); |
| 288 | - return " "; | 288 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 289 | } | 289 | } |
| 290 | else if (lineix == 1) | 290 | else if (lineix == 1) |
| 291 | { | 291 | { |
| @@ -295,14 +295,14 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS | @@ -295,14 +295,14 @@ namespace Vrh.Log4Pro.MaintenanceConsole.ScheduledTaskManagerNS | ||
| 295 | ColorConsole.Write($"{st.Xml_Enable}", ConsoleColor.Yellow, prefix: "After install: Enable=", suffix: ","); | 295 | ColorConsole.Write($"{st.Xml_Enable}", ConsoleColor.Yellow, prefix: "After install: Enable=", suffix: ","); |
| 296 | ColorConsole.Write($"{st.Xml_Run}", ConsoleColor.Yellow, prefix: "Run=", suffix: ". "); | 296 | ColorConsole.Write($"{st.Xml_Run}", ConsoleColor.Yellow, prefix: "Run=", suffix: ". "); |
| 297 | ColorConsole.WriteLine(" "); | 297 | ColorConsole.WriteLine(" "); |
| 298 | - return " "; | 298 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 299 | } | 299 | } |
| 300 | else if (lineix == 2) | 300 | else if (lineix == 2) |
| 301 | { | 301 | { |
| 302 | ColorConsole.WriteLine($"{st.Xml_Commandname}", ConsoleColor.Yellow, prefix: "Command: "); | 302 | ColorConsole.WriteLine($"{st.Xml_Commandname}", ConsoleColor.Yellow, prefix: "Command: "); |
| 303 | - return " "; | 303 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 304 | } | 304 | } |
| 305 | - return null; | 305 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 306 | } | 306 | } |
| 307 | #endregion private method: DisplayTaskInfo | 307 | #endregion private method: DisplayTaskInfo |
| 308 | #endregion private methods | 308 | #endregion private methods |
Vrh.Log4Pro.MaintenanceConsole/Manager - WebApplicationManager.cs
| @@ -595,7 +595,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -595,7 +595,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 595 | #endregion 1st level Executors | 595 | #endregion 1st level Executors |
| 596 | 596 | ||
| 597 | #region private method: DisplayWebAppInfo | 597 | #region private method: DisplayWebAppInfo |
| 598 | - private static object DisplayWebAppInfo(object obj, int lineix) | 598 | + private static Menu.MenuItemDisplayerReturnValue DisplayWebAppInfo(object obj, int lineix) |
| 599 | { | 599 | { |
| 600 | WebApplication wa = (obj as Menu.ExecutorParameter).Parameters as WebApplication; | 600 | WebApplication wa = (obj as Menu.ExecutorParameter).Parameters as WebApplication; |
| 601 | var numofvd = wa.Xml_VirtualDirectoryList?.Count()??0; | 601 | var numofvd = wa.Xml_VirtualDirectoryList?.Count()??0; |
| @@ -605,8 +605,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -605,8 +605,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 605 | if (lineix == 0) | 605 | if (lineix == 0) |
| 606 | { | 606 | { |
| 607 | ColorConsole.WriteLine($"{wa.Xml_Description}", ConsoleColor.Black, ConsoleColor.White); | 607 | ColorConsole.WriteLine($"{wa.Xml_Description}", ConsoleColor.Black, ConsoleColor.White); |
| 608 | - } | ||
| 609 | - else if (lineix == 1) | 608 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 609 | + } | ||
| 610 | + else if (lineix == 1) | ||
| 610 | { | 611 | { |
| 611 | ColorConsole.Write($"Web app:"); | 612 | ColorConsole.Write($"Web app:"); |
| 612 | ColorConsole.Write($"{wa.Xml_AppName}", ConsoleColor.Cyan); | 613 | ColorConsole.Write($"{wa.Xml_AppName}", ConsoleColor.Cyan); |
| @@ -616,13 +617,15 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -616,13 +617,15 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 616 | ColorConsole.Write($"{wa.ApplicationPath}", ConsoleColor.White); | 617 | ColorConsole.Write($"{wa.ApplicationPath}", ConsoleColor.White); |
| 617 | ColorConsole.Write($", Phy.path:"); | 618 | ColorConsole.Write($", Phy.path:"); |
| 618 | ColorConsole.WriteLine($"{wa.Xml_AppPhysicalPath}", ConsoleColor.White); | 619 | ColorConsole.WriteLine($"{wa.Xml_AppPhysicalPath}", ConsoleColor.White); |
| 619 | - } | ||
| 620 | - else if (lineix == 2) | 620 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 621 | + } | ||
| 622 | + else if (lineix == 2) | ||
| 621 | { | 623 | { |
| 622 | ColorConsole.Write($"impersonate identity:"); | 624 | ColorConsole.Write($"impersonate identity:"); |
| 623 | ColorConsole.WriteLine($"{wa.AppImpersonateIdentity}", ConsoleColor.White); | 625 | ColorConsole.WriteLine($"{wa.AppImpersonateIdentity}", ConsoleColor.White); |
| 624 | - } | ||
| 625 | - else if (lineix == 3) | 626 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 627 | + } | ||
| 628 | + else if (lineix == 3) | ||
| 626 | { | 629 | { |
| 627 | ColorConsole.Write($"Site:"); | 630 | ColorConsole.Write($"Site:"); |
| 628 | ColorConsole.Write($"{wa.Xml_SiteName}", ConsoleColor.Cyan); | 631 | ColorConsole.Write($"{wa.Xml_SiteName}", ConsoleColor.Cyan); |
| @@ -635,8 +638,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -635,8 +638,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 635 | ColorConsole.Write($"{wa.SitePortList}", ConsoleColor.White); | 638 | ColorConsole.Write($"{wa.SitePortList}", ConsoleColor.White); |
| 636 | ColorConsole.Write($", Phy.path:"); | 639 | ColorConsole.Write($", Phy.path:"); |
| 637 | ColorConsole.WriteLine($"{wa.Xml_SitePhysicalPath}", ConsoleColor.White); | 640 | ColorConsole.WriteLine($"{wa.Xml_SitePhysicalPath}", ConsoleColor.White); |
| 638 | - } | ||
| 639 | - else if (lineix == 4) | 641 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 642 | + } | ||
| 643 | + else if (lineix == 4) | ||
| 640 | { | 644 | { |
| 641 | ColorConsole.Write($"Pool:"); | 645 | ColorConsole.Write($"Pool:"); |
| 642 | ColorConsole.Write($"{wa.Xml_PoolName}", ConsoleColor.Cyan); | 646 | ColorConsole.Write($"{wa.Xml_PoolName}", ConsoleColor.Cyan); |
| @@ -648,8 +652,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -648,8 +652,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 648 | ColorConsole.Write($"{waps}", fc1, bracket: "()"); | 652 | ColorConsole.Write($"{waps}", fc1, bracket: "()"); |
| 649 | ColorConsole.Write($", identity:"); | 653 | ColorConsole.Write($", identity:"); |
| 650 | ColorConsole.WriteLine($"{wa.PoolAccount}", ConsoleColor.White); | 654 | ColorConsole.WriteLine($"{wa.PoolAccount}", ConsoleColor.White); |
| 651 | - } | ||
| 652 | - else if (5 <= lineix && lineix < 5+numofvd) | 655 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 656 | + } | ||
| 657 | + else if (5 <= lineix && lineix < 5+numofvd) | ||
| 653 | { | 658 | { |
| 654 | var elementindex = lineix - 5; | 659 | var elementindex = lineix - 5; |
| 655 | var currentelement = wa.Xml_VirtualDirectoryList.ElementAt(elementindex); | 660 | var currentelement = wa.Xml_VirtualDirectoryList.ElementAt(elementindex); |
| @@ -658,8 +663,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -658,8 +663,9 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 658 | ColorConsole.Write($", ("); | 663 | ColorConsole.Write($", ("); |
| 659 | ColorConsole.Write($"{currentelement.PhysicalPath}", ConsoleColor.Cyan); | 664 | ColorConsole.Write($"{currentelement.PhysicalPath}", ConsoleColor.Cyan); |
| 660 | ColorConsole.WriteLine($")"); | 665 | ColorConsole.WriteLine($")"); |
| 661 | - } | ||
| 662 | - else if (5+numofvd <= lineix && lineix < 5 + numofvd + numofwp) | 666 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 667 | + } | ||
| 668 | + else if (5+numofvd <= lineix && lineix < 5 + numofvd + numofwp) | ||
| 663 | { | 669 | { |
| 664 | var elementindex = lineix - (5 + numofvd); | 670 | var elementindex = lineix - (5 + numofvd); |
| 665 | if (numofwp == 0 || elementindex > numofwp - 1) { ColorConsole.WriteLine(); } | 671 | if (numofwp == 0 || elementindex > numofwp - 1) { ColorConsole.WriteLine(); } |
| @@ -683,13 +689,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | @@ -683,13 +689,13 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WebApplicationManagerNS | ||
| 683 | } | 689 | } |
| 684 | ColorConsole.WriteLine(); | 690 | ColorConsole.WriteLine(); |
| 685 | } | 691 | } |
| 686 | - } | ||
| 687 | - else | 692 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 693 | + } | ||
| 694 | + else | ||
| 688 | { | 695 | { |
| 689 | ColorConsole.WriteLine(); | 696 | ColorConsole.WriteLine(); |
| 690 | - return null; | 697 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 691 | } | 698 | } |
| 692 | - return ""; | ||
| 693 | } | 699 | } |
| 694 | #endregion private method: DisplayWebAppInfo | 700 | #endregion private method: DisplayWebAppInfo |
| 695 | } | 701 | } |
Vrh.Log4Pro.MaintenanceConsole/Manager - WindowsServiceManager.cs
| @@ -293,11 +293,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -293,11 +293,11 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 293 | #endregion DisplayServices | 293 | #endregion DisplayServices |
| 294 | 294 | ||
| 295 | #region private method: DisplayServiceInfo | 295 | #region private method: DisplayServiceInfo |
| 296 | - private static object DisplayServiceInfo(object obj, int lineix) | 296 | + private static Menu.MenuItemDisplayerReturnValue DisplayServiceInfo(object obj, int lineix) |
| 297 | { | 297 | { |
| 298 | - if (obj == null) { return null; } | 298 | + if (obj == null) { return Menu.MenuItemDisplayerReturnValue.EXIT; } |
| 299 | WindowsService ws = (obj as Menu.ExecutorParameter).Parameters as WindowsService; | 299 | WindowsService ws = (obj as Menu.ExecutorParameter).Parameters as WindowsService; |
| 300 | - if (ws == null) { return null; } | 300 | + if (ws == null) { return Menu.MenuItemDisplayerReturnValue.EXIT; } |
| 301 | if (lineix == 0) | 301 | if (lineix == 0) |
| 302 | { | 302 | { |
| 303 | ColorConsole.Write($"{ws.Description}", ConsoleColor.Black, ConsoleColor.White); | 303 | ColorConsole.Write($"{ws.Description}", ConsoleColor.Black, ConsoleColor.White); |
| @@ -305,8 +305,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -305,8 +305,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 305 | ColorConsole.Write($", User:"); | 305 | ColorConsole.Write($", User:"); |
| 306 | ColorConsole.Write($"{ws.StartName}", ConsoleColor.White); | 306 | ColorConsole.Write($"{ws.StartName}", ConsoleColor.White); |
| 307 | ColorConsole.WriteLine(); | 307 | ColorConsole.WriteLine(); |
| 308 | - return ws.DisplayName + ws.Description; | ||
| 309 | - } | 308 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 309 | + } | ||
| 310 | else if (lineix == 1) | 310 | else if (lineix == 1) |
| 311 | { | 311 | { |
| 312 | ColorConsole.Write($"Win service:"); | 312 | ColorConsole.Write($"Win service:"); |
| @@ -339,7 +339,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -339,7 +339,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 339 | ColorConsole.Write($"{ws.ProcessId}", ConsoleColor.White); | 339 | ColorConsole.Write($"{ws.ProcessId}", ConsoleColor.White); |
| 340 | } | 340 | } |
| 341 | ColorConsole.WriteLine(); | 341 | ColorConsole.WriteLine(); |
| 342 | - return ws.Name; | 342 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 343 | } | 343 | } |
| 344 | else if (lineix == 2) | 344 | else if (lineix == 2) |
| 345 | { | 345 | { |
| @@ -371,32 +371,32 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | @@ -371,32 +371,32 @@ namespace Vrh.Log4Pro.MaintenanceConsole.WindowsServiceManagerNS | ||
| 371 | ColorConsole.Write(downtimetext, ConsoleColor.Red); | 371 | ColorConsole.Write(downtimetext, ConsoleColor.Red); |
| 372 | } | 372 | } |
| 373 | ColorConsole.WriteLine(); | 373 | ColorConsole.WriteLine(); |
| 374 | - return " "; | 374 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 375 | } | 375 | } |
| 376 | else if (lineix == 3) | 376 | else if (lineix == 3) |
| 377 | { | 377 | { |
| 378 | - if (string.IsNullOrEmpty(ws.PathName)) { return ""; } | 378 | + if (string.IsNullOrWhiteSpace(ws.PathName)) { return Menu.MenuItemDisplayerReturnValue.SAMELINE; } |
| 379 | var cmdarray = CommandLineParser.SplitArgs(ws.PathName).ToArray(); | 379 | var cmdarray = CommandLineParser.SplitArgs(ws.PathName).ToArray(); |
| 380 | ColorConsole.Write($"Start command:"); | 380 | ColorConsole.Write($"Start command:"); |
| 381 | ColorConsole.WriteLine($"{cmdarray[0]}", ConsoleColor.White); | 381 | ColorConsole.WriteLine($"{cmdarray[0]}", ConsoleColor.White); |
| 382 | - return ws.PathName; | 382 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 383 | } | 383 | } |
| 384 | else if (lineix == 4) | 384 | else if (lineix == 4) |
| 385 | { | 385 | { |
| 386 | - if (string.IsNullOrEmpty(ws.PathName)) { return ""; } | 386 | + if (string.IsNullOrWhiteSpace(ws.PathName)) { return Menu.MenuItemDisplayerReturnValue.SAMELINE; } |
| 387 | var cmdparams = CommandLineParser.SplitArgs(ws.PathName).Skip(1).ToArray(); | 387 | var cmdparams = CommandLineParser.SplitArgs(ws.PathName).Skip(1).ToArray(); |
| 388 | - if (cmdparams.Length == 0) { return ""; } | 388 | + if (cmdparams.Length == 0) { return Menu.MenuItemDisplayerReturnValue.SAMELINE;} |
| 389 | var cmdparamsstr = "["+string.Join("][", cmdparams)+"]"; | 389 | var cmdparamsstr = "["+string.Join("][", cmdparams)+"]"; |
| 390 | ColorConsole.Write($"Start arguments:"); | 390 | ColorConsole.Write($"Start arguments:"); |
| 391 | ColorConsole.WriteLine(cmdparamsstr, ConsoleColor.White); | 391 | ColorConsole.WriteLine(cmdparamsstr, ConsoleColor.White); |
| 392 | - return cmdparamsstr; | 392 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 393 | } | 393 | } |
| 394 | else if (lineix == 5) | 394 | else if (lineix == 5) |
| 395 | { | 395 | { |
| 396 | ColorConsole.WriteLine(); | 396 | ColorConsole.WriteLine(); |
| 397 | - return " "; | 397 | + return Menu.MenuItemDisplayerReturnValue.NEXTLINE; |
| 398 | } | 398 | } |
| 399 | - return null; | 399 | + return Menu.MenuItemDisplayerReturnValue.EXIT; |
| 400 | } | 400 | } |
| 401 | #endregion private method: DisplayServiceInfo | 401 | #endregion private method: DisplayServiceInfo |
| 402 | 402 |
Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs
| @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | ||
| 32 | // You can specify all the values or you can default the Build and Revision Numbers | 32 | // You can specify all the values or you can default the Build and Revision Numbers |
| 33 | // by using the '*' as shown below: | 33 | // by using the '*' as shown below: |
| 34 | // [assembly: AssemblyVersion("1.0.*")] | 34 | // [assembly: AssemblyVersion("1.0.*")] |
| 35 | -[assembly: AssemblyVersion("1.29.3.0")] | ||
| 36 | -[assembly: AssemblyFileVersion("1.29.3.0")] | 35 | +[assembly: AssemblyVersion("1.30.0.0")] |
| 36 | +[assembly: AssemblyFileVersion("1.30.0.0")] |