diff --git a/.editorconfig b/.editorconfig index 650e00d..fc1c233 100644 --- a/.editorconfig +++ b/.editorconfig @@ -107,7 +107,9 @@ dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031) dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) +dotnet_diagnostic.IDE0058.severity = warning # IDE0058: Expression value is never used dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter +dotnet_diagnostic.IDE0074.severity = warning # IDE0074: Use compound assignment dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290) dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified diff --git a/.vscode/launch.json b/.vscode/launch.json index 5971abe..de680ce 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,9 @@ "program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll", "args": [ "s", - "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\Traces\\HTR-PLC\\R72-PLC\\PollPath" + "X", + "Day/2024-Q1", + "Day-Helper-2024-01-08" ], "cwd": "${workspaceFolder}", "console": "integratedTerminal", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 702b664..9309c24 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -100,91 +100,91 @@ { "label": "File-Folder-Helper AOT s H Run Data Repository", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s J Verdaccio", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s J 'L:/Verdaccio/storage'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s J 'L:/Verdaccio/storage'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s M Self .Kanbn Tasks", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s M '.kanbn/tasks'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s M '.kanbn/tasks'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s S BaGet", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s S 'L:/BaGet/packages'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s S 'L:/BaGet/packages'", "problemMatcher": [] }, { - "label": "File-Folder-Helper AOT s V Helpers", + "label": "File-Folder-Helper AOT s X SortCodeMethods", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s V Helpers", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s X Day/2024-Q1 Day-Helper-2024-01-08", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08ANLYSDIFAAST230", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08ANLYSDIFAAST230\\Source\\MET08ANLYSDIFAAST230'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08ANLYSDIFAAST230\\Source\\MET08ANLYSDIFAAST230'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08DDUPSFS6420", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08DDUPSFS6420\\Source\\MET08DDUPSFS6420'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08DDUPSFS6420\\Source\\MET08DDUPSFS6420'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08DDUPSP1TBI", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08DDUPSP1TBI\\Source\\MET08DDUPSP1TBI'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08DDUPSP1TBI\\Source\\MET08DDUPSP1TBI'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08RESIHGCV", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESIHGCV\\Source\\MET08RESIHGCV'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESIHGCV\\Source\\MET08RESIHGCV'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08RESIMAPCDE", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESIMAPCDE\\Source\\MET08RESIMAPCDE'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESIMAPCDE\\Source\\MET08RESIMAPCDE'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08RESISRP2100", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESISRP2100\\Source\\MET08RESISRP2100'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08RESISRP2100\\Source\\MET08RESISRP2100'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08THFTIRQS408M", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08THFTIRQS408M\\Source\\MET08THFTIRQS408M'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08THFTIRQS408M\\Source\\MET08THFTIRQS408M'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H MET08THFTIRSTRATUS", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08THFTIRSTRATUS\\Source\\MET08THFTIRSTRATUS'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\Metrology\\Run Data Repository\\MET08THFTIRSTRATUS\\Source\\MET08THFTIRSTRATUS'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s H WaferCounter", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\WaferCounter\\BackupFiles'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s H '\\\\messa01ec.infineon.com\\apps\\WaferCounter\\BackupFiles'", "problemMatcher": [] }, { "label": "File-Folder-Helper AOT s F Staging _Logs", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s F '\\\\messv02ecc1.ec.local\\EC_EAFLog\\Staging\\_ Logs'", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s F '\\\\messv02ecc1.ec.local\\EC_EAFLog\\Staging\\_ Logs'", "problemMatcher": [] }, { diff --git a/Day/Helper-2023-09-06.cs b/Day/2023-Q3/Helper-2023-09-06.cs similarity index 97% rename from Day/Helper-2023-09-06.cs rename to Day/2023-Q3/Helper-2023-09-06.cs index 8f31d15..a749b1b 100644 --- a/Day/Helper-2023-09-06.cs +++ b/Day/2023-Q3/Helper-2023-09-06.cs @@ -43,8 +43,10 @@ internal static class Helper20230906 httpRequestMessage.Headers.Add(segments[0], segments[1]); } } +#pragma warning disable IL2026, IL3050 if (jsonBodyLine is not null) httpRequestMessage.Content = JsonContent.Create(lines[jsonBodyLine.Value]); +#pragma warning restore IL2026, IL3050 httpClient = new(new HttpClientHandler { UseCookies = false }) { BaseAddress = new Uri(lines[0]) }; if (userAgent is not null) httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(userAgent); diff --git a/Day/Helper-2023-10-10.cs b/Day/2023-Q4/Helper-2023-10-10.cs similarity index 100% rename from Day/Helper-2023-10-10.cs rename to Day/2023-Q4/Helper-2023-10-10.cs diff --git a/Day/Helper-2023-10-16.cs b/Day/2023-Q4/Helper-2023-10-16.cs similarity index 100% rename from Day/Helper-2023-10-16.cs rename to Day/2023-Q4/Helper-2023-10-16.cs diff --git a/Day/Helper-2023-10-24.cs b/Day/2023-Q4/Helper-2023-10-24.cs similarity index 100% rename from Day/Helper-2023-10-24.cs rename to Day/2023-Q4/Helper-2023-10-24.cs diff --git a/Day/Helper-2023-11-02.cs b/Day/2023-Q4/Helper-2023-11-02.cs similarity index 100% rename from Day/Helper-2023-11-02.cs rename to Day/2023-Q4/Helper-2023-11-02.cs diff --git a/Day/Helper-2023-11-08.cs b/Day/2023-Q4/Helper-2023-11-08.cs similarity index 100% rename from Day/Helper-2023-11-08.cs rename to Day/2023-Q4/Helper-2023-11-08.cs diff --git a/Day/Helper-2023-11-22.cs b/Day/2023-Q4/Helper-2023-11-22.cs similarity index 98% rename from Day/Helper-2023-11-22.cs rename to Day/2023-Q4/Helper-2023-11-22.cs index a62aa31..308cd7f 100644 --- a/Day/Helper-2023-11-22.cs +++ b/Day/2023-Q4/Helper-2023-11-22.cs @@ -13,6 +13,7 @@ internal static class Helper20231122 private static ReadOnlyCollection GetRecords(string sourceDirectory, string timestampFormat) { List results = []; + Record record; string fileName; string equipment; string timestamp; @@ -28,7 +29,8 @@ internal static class Helper20231122 timestamp = segments[1].Split('.')[0]; if (timestamp.Length != timestampFormat.Length) continue; - results.Add(new(file, fileName, equipment, timestamp)); + record = new(file, fileName, equipment, timestamp); + results.Add(record); } return new(results.OrderBy(l => l.TimeStamp).ToArray()); } diff --git a/Day/Helper-2023-11-30.cs b/Day/2023-Q4/Helper-2023-11-30.cs similarity index 97% rename from Day/Helper-2023-11-30.cs rename to Day/2023-Q4/Helper-2023-11-30.cs index 27515aa..f328964 100644 --- a/Day/Helper-2023-11-30.cs +++ b/Day/2023-Q4/Helper-2023-11-30.cs @@ -9,29 +9,6 @@ internal static class Helper20231130 private record Record(string File, string FileName, string Equipment, string TimeStamp); - private static ReadOnlyCollection GetRecords(string sourceDirectory, string timestampFormat) - { - List results = []; - string fileName; - string equipment; - string timestamp; - string[] segments; - string[] files = Directory.GetFiles(sourceDirectory, "*.pdsf", SearchOption.TopDirectoryOnly).ToArray(); - foreach (string file in files) - { - fileName = Path.GetFileName(file); - segments = fileName.Split('_'); - if (segments.Length != 2) - continue; - equipment = segments[0]; - timestamp = segments[1].Split('.')[0]; - if (timestamp.Length != timestampFormat.Length) - continue; - results.Add(new(file, fileName, equipment, timestamp)); - } - return new(results.OrderBy(l => l.TimeStamp).ToArray()); - } - private static ReadOnlyDictionary GetSystemStates() { Dictionary results = []; @@ -50,6 +27,31 @@ internal static class Helper20231130 return new(results); } + private static ReadOnlyCollection GetRecords(string sourceDirectory, string timestampFormat) + { + List results = []; + Record record; + string fileName; + string equipment; + string timestamp; + string[] segments; + string[] files = Directory.GetFiles(sourceDirectory, "*.pdsf", SearchOption.TopDirectoryOnly).ToArray(); + foreach (string file in files) + { + fileName = Path.GetFileName(file); + segments = fileName.Split('_'); + if (segments.Length != 2) + continue; + equipment = segments[0]; + timestamp = segments[1].Split('.')[0]; + if (timestamp.Length != timestampFormat.Length) + continue; + record = new(file, fileName, equipment, timestamp); + results.Add(record); + } + return new(results.OrderBy(l => l.TimeStamp).ToArray()); + } + internal static void RenameReactorProcessDataStandardFormatFiles(ILogger logger, List args) { string line; diff --git a/Day/Helper-2023-12-05.cs b/Day/2023-Q4/Helper-2023-12-05.cs similarity index 94% rename from Day/Helper-2023-12-05.cs rename to Day/2023-Q4/Helper-2023-12-05.cs index 1ea9b6a..8078e4f 100644 --- a/Day/Helper-2023-12-05.cs +++ b/Day/2023-Q4/Helper-2023-12-05.cs @@ -6,6 +6,20 @@ namespace File_Folder_Helper.Day; internal static partial class Helper20231205 { + private static string? GetStrippedMacAddress(string[] segments) + { + string? result = null; + foreach (string segment in segments) + { + if (segment.Length != 17) + continue; + if (segment[2] is not ':' or '-' || segment[5] is not ':' or '-' || segment[8] is not ':' or '-' || segment[11] is not ':' or '-' || segment[14] is not ':' or '-') + continue; + result = $"{segment[0]}{segment[1]}{segment[3]}{segment[4]}{segment[6]}{segment[7]}{segment[9]}{segment[10]}{segment[12]}{segment[13]}{segment[15]}{segment[16]}".ToLower(); + } + return result; + } + [GeneratedRegex(@"[\\,\/,\:,\*,\?,\"",\<,\>,\|]")] private static partial Regex WindowsSafe(); @@ -25,24 +39,11 @@ internal static partial class Helper20231205 return result; } - private static string? GetStrippedMacAddress(string[] segments) - { - string? result = null; - foreach (string segment in segments) - { - if (segment.Length != 17) - continue; - if (segment[2] is not ':' or '-' || segment[5] is not ':' or '-' || segment[8] is not ':' or '-' || segment[11] is not ':' or '-' || segment[14] is not ':' or '-') - continue; - result = $"{segment[0]}{segment[1]}{segment[3]}{segment[4]}{segment[6]}{segment[7]}{segment[9]}{segment[10]}{segment[12]}{segment[13]}{segment[15]}{segment[16]}".ToLower(); - } - return result; - } - internal static void SplitMarkdownFile(ILogger logger, List args) { string[] lines; string? fileName; + Regex windowsSafe; string[] segments; string checkFileName; string? strippedIpV4; @@ -69,7 +70,10 @@ internal static partial class Helper20231205 strippedIpV4 = GetStrippedIPV4(segments); strippedMacAddress = GetStrippedMacAddress(segments); if (strippedMacAddress is null && strippedIpV4 is null) - fileName = $"{WindowsSafe().Replace(line[3..], "-").Trim().ToLower()}.md"; + { + windowsSafe = WindowsSafe(); + fileName = $"{windowsSafe.Replace(line[3..], "-").Trim().ToLower()}.md"; + } else if (strippedMacAddress is null) { fileName = $"ipv4-{strippedIpV4}.md"; diff --git a/Day/Helper-2023-12-12.cs b/Day/2023-Q4/Helper-2023-12-12.cs similarity index 99% rename from Day/Helper-2023-12-12.cs rename to Day/2023-Q4/Helper-2023-12-12.cs index 17b865a..e31bc96 100644 --- a/Day/Helper-2023-12-12.cs +++ b/Day/2023-Q4/Helper-2023-12-12.cs @@ -2,16 +2,12 @@ using Microsoft.Extensions.Logging; using System.Collections.ObjectModel; using System.Text.Json; using System.Text.Json.Serialization; -using System.Text.RegularExpressions; namespace File_Folder_Helper.Day; internal static partial class Helper20231212 { - [GeneratedRegex(@"[\\,\/,\:,\*,\?,\"",\<,\>,\|]")] - private static partial Regex WindowsSafe(); - private record Debugging( [property: JsonPropertyName("Level")] int Level ); @@ -352,6 +348,16 @@ internal static partial class Helper20231212 return result; } + private static ReadOnlyCollection> GetHostLinesSpaceSegments() + { + List> results = []; + string hostFile = "C:/Windows/System32/drivers/etc/hosts"; + string[] lines = !File.Exists(hostFile) ? [] : File.ReadAllLines(hostFile); + foreach (string line in lines) + results.Add(new(line.Split(' '))); + return new(results); + } + private static string[] GetMacAddressSegments(string value) { string[] result; @@ -370,16 +376,6 @@ internal static partial class Helper20231212 return result; } - private static ReadOnlyCollection> GetHostLinesSpaceSegments() - { - List> results = []; - string hostFile = "C:/Windows/System32/drivers/etc/hosts"; - string[] lines = !File.Exists(hostFile) ? [] : File.ReadAllLines(hostFile); - foreach (string line in lines) - results.Add(new(line.Split(' '))); - return new(results); - } - internal static void SplitJsonFile(ILogger logger, List args) { string json; diff --git a/Day/Helper-2023-12-22.cs b/Day/2023-Q4/Helper-2023-12-22.cs similarity index 100% rename from Day/Helper-2023-12-22.cs rename to Day/2023-Q4/Helper-2023-12-22.cs index 69b0ac5..93afe62 100644 --- a/Day/Helper-2023-12-22.cs +++ b/Day/2023-Q4/Helper-2023-12-22.cs @@ -33,53 +33,6 @@ internal static partial class Helper20231222 private static short GetSortOrderOnlyLengthIndex(MetadataConfiguration metadataConfiguration) => (short)metadataConfiguration.Offset.ToString().Length; - private static int GetId(MetadataConfiguration metadataConfiguration, string intelligentId) - { - int result; - StringBuilder results = new(); - if (metadataConfiguration.IntMinValueLength < (metadataConfiguration.ResultAllInOneSubdirectoryLength + 2)) - throw new NotSupportedException(); - for (int i = intelligentId.Length - (metadataConfiguration.ResultAllInOneSubdirectoryLength + 2); i > -1; i--) - _ = results.Append(intelligentId[i]); - _ = results.Append(intelligentId[^3]).Append(intelligentId[^2]); - result = int.Parse(results.ToString()); - if (intelligentId[^1] is '1' or '2') - result *= -1; - else if (intelligentId[^1] is not '9' and not '8') - throw new NotSupportedException(); - return result; - } - - private static IntelligentIdRecord GetIntelligentIdRecord(MetadataConfiguration metadataConfiguration, long id, bool ignore) - { - IntelligentIdRecord result; - StringBuilder stringBuilder = new(); - if (metadataConfiguration.IntMinValueLength < (metadataConfiguration.ResultAllInOneSubdirectoryLength + 2)) - throw new NotSupportedException(); - int key; - string value; - List chars = []; - if (id > -1) - { - key = ignore ? 8 : 9; - value = id.ToString().PadLeft(metadataConfiguration.IntMinValueLength, '0'); - } - else - { - key = ignore ? 2 : 1; - value = id.ToString()[1..].PadLeft(metadataConfiguration.IntMinValueLength, '0'); - } - for (int i = value.Length - metadataConfiguration.ResultAllInOneSubdirectoryLength - 1; i > -1; i--) - _ = stringBuilder.Append(value[i]); - for (int i = value.Length - metadataConfiguration.ResultAllInOneSubdirectoryLength; i < value.Length; i++) - chars.Add(value[i]); - result = new(key, new(chars), stringBuilder.ToString()); - return result; - } - - private static string GetIntelligentId(IntelligentIdRecord intelligentId) => - $"{intelligentId.Reverse}{string.Join(string.Empty, intelligentId.ResultAllInOneSubdirectoryChars)}{intelligentId.Key}"; - private static bool NameWithoutExtensionIsIntelligentIdFormat(MetadataConfiguration metadataConfiguration, string fileNameFirstSegment) => fileNameFirstSegment.Length - 1 == metadataConfiguration.IntMinValueLength && fileNameFirstSegment[^1] is '1' or '2' or '8' or '9' && fileNameFirstSegment.All(char.IsNumber); @@ -148,6 +101,53 @@ internal static partial class Helper20231222 return result; } + private static IntelligentIdRecord GetIntelligentIdRecord(MetadataConfiguration metadataConfiguration, long id, bool ignore) + { + IntelligentIdRecord result; + StringBuilder stringBuilder = new(); + if (metadataConfiguration.IntMinValueLength < (metadataConfiguration.ResultAllInOneSubdirectoryLength + 2)) + throw new NotSupportedException(); + int key; + string value; + List chars = []; + if (id > -1) + { + key = ignore ? 8 : 9; + value = id.ToString().PadLeft(metadataConfiguration.IntMinValueLength, '0'); + } + else + { + key = ignore ? 2 : 1; + value = id.ToString()[1..].PadLeft(metadataConfiguration.IntMinValueLength, '0'); + } + for (int i = value.Length - metadataConfiguration.ResultAllInOneSubdirectoryLength - 1; i > -1; i--) + _ = stringBuilder.Append(value[i]); + for (int i = value.Length - metadataConfiguration.ResultAllInOneSubdirectoryLength; i < value.Length; i++) + chars.Add(value[i]); + result = new(key, new(chars), stringBuilder.ToString()); + return result; + } + + private static string GetIntelligentId(IntelligentIdRecord intelligentId) => + $"{intelligentId.Reverse}{string.Join(string.Empty, intelligentId.ResultAllInOneSubdirectoryChars)}{intelligentId.Key}"; + + private static int GetId(MetadataConfiguration metadataConfiguration, string intelligentId) + { + int result; + StringBuilder results = new(); + if (metadataConfiguration.IntMinValueLength < (metadataConfiguration.ResultAllInOneSubdirectoryLength + 2)) + throw new NotSupportedException(); + for (int i = intelligentId.Length - (metadataConfiguration.ResultAllInOneSubdirectoryLength + 2); i > -1; i--) + _ = results.Append(intelligentId[i]); + _ = results.Append(intelligentId[^3]).Append(intelligentId[^2]); + result = int.Parse(results.ToString()); + if (intelligentId[^1] is '1' or '2') + result *= -1; + else if (intelligentId[^1] is not '9' and not '8') + throw new NotSupportedException(); + return result; + } + private static ReadOnlyCollection GetRecords(MetadataConfiguration metadataConfiguration, string sourceDirectory, string searchPattern) { List results = []; diff --git a/Day/Helper-2024-01-05.cs b/Day/2024-Q1/Helper-2024-01-05.cs similarity index 98% rename from Day/Helper-2024-01-05.cs rename to Day/2024-Q1/Helper-2024-01-05.cs index 9d4f526..dd80816 100644 --- a/Day/Helper-2024-01-05.cs +++ b/Day/2024-Q1/Helper-2024-01-05.cs @@ -1020,6 +1020,28 @@ internal static partial class Helper20240105 { } + private static int GetDeterministicHashCode(byte[] value) + { + int result; + unchecked + { + int hash1 = (5381 << 16) + 5381; + int hash2 = hash1; + for (int i = 0; i < value.Length; i += 2) + { + hash1 = ((hash1 << 5) + hash1) ^ value[i]; + if (i == value.Length - 1) + break; + hash2 = ((hash2 << 5) + hash2) ^ value[i + 1]; + } + result = hash1 + (hash2 * 1566083941); + } + return result; + } + + private static string? ConvertPassword(string? value) => + string.IsNullOrEmpty(value) ? "-" : GetDeterministicHashCode(System.Text.Encoding.ASCII.GetBytes(value)).ToString(); + private static Item? GetEntry(Guid folderId, string folderName, KeePassFileGroupEntry keePassFileGroupEntry) { Item? result; @@ -1081,29 +1103,109 @@ internal static partial class Helper20240105 return result; } - internal static int GetDeterministicHashCode(byte[] value) + private static List GetItems(Guid folderId, string folderName, KeePassFileGroup keePassFileGroup) { - int result; - unchecked + List results = []; + if (keePassFileGroup.Entry is not null) { - int hash1 = (5381 << 16) + 5381; - int hash2 = hash1; - for (int i = 0; i < value.Length; i += 2) + Item? item; + foreach (KeePassFileGroupEntry keePassFileGroupEntry in keePassFileGroup.Entry) { - hash1 = ((hash1 << 5) + hash1) ^ value[i]; - if (i == value.Length - 1) - break; - hash2 = ((hash2 << 5) + hash2) ^ value[i + 1]; + item = GetEntry(folderId, folderName, keePassFileGroupEntry); + if (item is null) + continue; + results.Add(item); } - result = hash1 + (hash2 * 1566083941); + } + if (keePassFileGroup.Group is not null) + { + foreach (KeePassFileGroup keePassFileGroupInner in keePassFileGroup.Group) + { + folderId = Guid.NewGuid(); + results.AddRange(GetItems(folderId, $"{folderName}/{keePassFileGroupInner.Name}", keePassFileGroupInner)); + } + } + return results; + } + + private static MemoryStream ToStream(string @this) + { + MemoryStream memoryStream = new(); + StreamWriter streamWriter = new(memoryStream); + streamWriter.Write(@this); + streamWriter.Flush(); + memoryStream.Position = 0; + return memoryStream; + } + + private static KeePassFile? ParseXML(string value, bool throwExceptions) + { + KeePassFile? result; + try + { + Type type = typeof(KeePassFile); + Stream stream = ToStream(value.Trim()); + XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document }); +#pragma warning disable IL2026 + XmlSerializer xmlSerializer = new(type, type.GetNestedTypes()); + result = xmlSerializer.Deserialize(xmlReader) as KeePassFile; +#pragma warning restore IL2026 + stream.Dispose(); + } + catch (Exception) + { + if (throwExceptions) + throw; + result = null; } return result; } - private static string? ConvertPassword(string? value) => - // string.IsNullOrEmpty(value) ? "-" : string.Join('-', from l in value select l); - // string.IsNullOrEmpty(value) ? "-" : string.Join('-', from l in value orderby random.Next() select l); - string.IsNullOrEmpty(value) ? "-" : GetDeterministicHashCode(System.Text.Encoding.ASCII.GetBytes(value)).ToString(); + private static List GetItems(KeePassFileRoot keePassFileRoot) + { + List results = []; + Guid folderId = Guid.NewGuid(); + string folderName = string.Empty; + if (keePassFileRoot.Entry is not null) + { + Item? item; + foreach (KeePassFileGroupEntry keePassFileGroupEntry in keePassFileRoot.Entry) + { + item = GetEntry(folderId, folderName, keePassFileGroupEntry); + if (item is null) + continue; + results.Add(item); + } + } + if (keePassFileRoot.Group is not null) + { + foreach (KeePassFileGroup keePassFileGroup in keePassFileRoot.Group) + { + folderId = Guid.NewGuid(); + folderName = keePassFileGroup.Name; + results.AddRange(GetItems(folderId, folderName, keePassFileGroup)); + } + } + return results; + } + + private static List GetFolders(List items) + { + List results = []; + Folder folder; + List distinct = []; + foreach (Item item in items) + { + if (item.FolderName is null) + throw new NullReferenceException(nameof(item.FolderName)); + if (distinct.Contains(item.FolderName)) + continue; + distinct.Add(item.FolderName); + folder = new(item.FolderId, item.FolderName); + results.Add(folder); + } + return results; + } private static List Filter(string xmlFile, ILogger logger, List items) { @@ -1208,110 +1310,6 @@ internal static partial class Helper20240105 File.WriteAllLines(Path.ChangeExtension(xmlFile, ".tvs"), lines); } - private static MemoryStream ToStream(string @this) - { - MemoryStream memoryStream = new(); - StreamWriter streamWriter = new(memoryStream); - streamWriter.Write(@this); - streamWriter.Flush(); - memoryStream.Position = 0; - return memoryStream; - } - - private static KeePassFile? ParseXML(string @this, bool throwExceptions) - { - KeePassFile? result; - try - { - Type type = typeof(KeePassFile); - Stream stream = ToStream(@this.Trim()); - XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document }); -#pragma warning disable IL2026 - XmlSerializer xmlSerializer = new(type, type.GetNestedTypes()); - result = xmlSerializer.Deserialize(xmlReader) as KeePassFile; -#pragma warning restore IL2026 - stream.Dispose(); - } - catch (Exception) - { - if (throwExceptions) - throw; - result = null; - } - return result; - } - - private static List GetItems(Guid folderId, string folderName, KeePassFileGroup keePassFileGroup) - { - List results = []; - if (keePassFileGroup.Entry is not null) - { - Item? item; - foreach (KeePassFileGroupEntry keePassFileGroupEntry in keePassFileGroup.Entry) - { - item = GetEntry(folderId, folderName, keePassFileGroupEntry); - if (item is null) - continue; - results.Add(item); - } - } - if (keePassFileGroup.Group is not null) - { - foreach (KeePassFileGroup keePassFileGroupInner in keePassFileGroup.Group) - { - folderId = Guid.NewGuid(); - results.AddRange(GetItems(folderId, $"{folderName}/{keePassFileGroupInner.Name}", keePassFileGroupInner)); - } - } - return results; - } - - private static List GetItems(KeePassFileRoot keePassFileRoot) - { - List results = []; - Guid folderId = Guid.NewGuid(); - string folderName = string.Empty; - if (keePassFileRoot.Entry is not null) - { - Item? item; - foreach (KeePassFileGroupEntry keePassFileGroupEntry in keePassFileRoot.Entry) - { - item = GetEntry(folderId, folderName, keePassFileGroupEntry); - if (item is null) - continue; - results.Add(item); - } - } - if (keePassFileRoot.Group is not null) - { - foreach (KeePassFileGroup keePassFileGroup in keePassFileRoot.Group) - { - folderId = Guid.NewGuid(); - folderName = keePassFileGroup.Name; - results.AddRange(GetItems(folderId, folderName, keePassFileGroup)); - } - } - return results; - } - - private static List GetFolders(List items) - { - List results = []; - Folder folder; - List distinct = []; - foreach (Item item in items) - { - if (item.FolderName is null) - throw new NullReferenceException(nameof(item.FolderName)); - if (distinct.Contains(item.FolderName)) - continue; - distinct.Add(item.FolderName); - folder = new(item.FolderId, item.FolderName); - results.Add(folder); - } - return results; - } - internal static void ConvertKeePassExport(ILogger logger, List args) { Root root; diff --git a/Day/2024-Q1/Helper-2024-01-06.cs b/Day/2024-Q1/Helper-2024-01-06.cs new file mode 100644 index 0000000..a6b7dac --- /dev/null +++ b/Day/2024-Q1/Helper-2024-01-06.cs @@ -0,0 +1,128 @@ +using Microsoft.Extensions.Logging; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace File_Folder_Helper.Day; + +internal static partial class Helper20240106 +{ + + [JsonSourceGenerationOptions(WriteIndented = true)] + [JsonSerializable(typeof(Dictionary>))] + private partial class DictionaryDictionarySourceGenerationContext : JsonSerializerContext + { + } + + private record Record(string Key, Dictionary KeyValuePairs); + + private static Dictionary> GetKeyValuePairs(List collection, bool replaceFound) + { + Dictionary> results = []; + if (replaceFound) + { + foreach ((string key, Dictionary keyValuePairs) in collection) + _ = results.TryAdd(key, keyValuePairs); + } + else + { + foreach ((string key, Dictionary keyValuePairs) in collection.OrderBy(l => l.Key)) + _ = results.TryAdd(key, keyValuePairs); + } + return results; + } + + private static int? GetHeaderLine(string[] lines) + { + int? headerLine = null; + for (int i = 0; i < lines.Length - 1; i++) + { + if (!lines[i].Contains('\t')) + continue; + headerLine = i; + } + return headerLine; + } + + private static Dictionary> GetKeyValuePairs(int keyIndex, int keyLength, string replace, string[] headers, string[] lines, int headerLine) + { + Dictionary> results; + string? key; + Record record; + bool replaceFound = false; + List collection = []; + Dictionary keyValuePairs; + for (int i = headerLine + 1; i < lines.Length; i++) + { + key = null; + keyValuePairs = []; + for (int j = 0; j < headers.Length; j++) + { + if (j > 0) + i++; + if (lines.Length <= i) + { + keyValuePairs.Clear(); + break; + } + if (j == keyIndex) + { + key = lines[i]; + if (key.Length != keyLength) + { + keyValuePairs.Clear(); + break; + } + } + if (lines[i] != replace) + _ = keyValuePairs.TryAdd(headers[j], lines[i]); + else + { + if (!replaceFound) + replaceFound = true; + _ = keyValuePairs.TryAdd(headers[j], lines[i]); + j++; + _ = keyValuePairs.TryAdd(headers[j], lines[i]); + } + } + if (keyValuePairs.Count != headers.Length) + continue; + key ??= "-"; + record = new(key, keyValuePairs); + collection.Add(record); + } + results = GetKeyValuePairs(collection, replaceFound); + return results; + } + + internal static void TextToJson(ILogger logger, List args) + { + string json; + string[] lines; + int? headerLine; + FileInfo fileInfo; + string replace = args[6]; + int keyIndex = int.Parse(args[4]); + int keyLength = int.Parse(args[5]); + string[] headers = args[7].Split(','); + string[] txtFiles = Directory.GetFiles(args[0], args[2]); + Dictionary> keyValuePairs; + foreach (string txtFile in txtFiles) + { + lines = File.ReadAllLines(txtFile); + if (lines.Length == 0) + continue; + headerLine = GetHeaderLine(lines); + if (headerLine is null) + continue; + fileInfo = new(txtFile); + keyValuePairs = GetKeyValuePairs(keyIndex, keyLength, replace, headers, lines, headerLine.Value); + if (keyValuePairs.Count == 0) + continue; + json = JsonSerializer.Serialize(keyValuePairs, DictionaryDictionarySourceGenerationContext.Default.DictionaryStringDictionaryStringString); + logger.LogInformation("Writing output file..."); + File.WriteAllText($"{txtFile}-{fileInfo.LastWriteTime.Ticks}.json", json); + File.WriteAllText(txtFile, string.Empty); + } + } + +} \ No newline at end of file diff --git a/Day/2024-Q1/Helper-2024-01-07.cs b/Day/2024-Q1/Helper-2024-01-07.cs new file mode 100644 index 0000000..ccf4859 --- /dev/null +++ b/Day/2024-Q1/Helper-2024-01-07.cs @@ -0,0 +1,38 @@ +using DiscUtils.Iso9660; +using Microsoft.Extensions.Logging; + +namespace File_Folder_Helper.Day; + +internal static partial class Helper20240107 +{ + + private static void DirectoryToISO(ILogger logger, string destinationDirectory, string directory) + { + string relativePath; + string directoryName = Path.GetFileName(directory); + CDBuilder builder = new() { UseJoliet = true, VolumeIdentifier = directoryName }; + IEnumerable files = Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories); + foreach (string file in files) + { + relativePath = Path.GetRelativePath(directory, file); + _ = builder.AddFile(relativePath, file); + } + logger.LogInformation(destinationDirectory); + builder.Build(Path.Combine(destinationDirectory, $"{directoryName}.iso")); + logger.LogInformation(directoryName); + } + + internal static void DirectoryToISO(ILogger logger, List args) + { + string sourceDirectory = args[0]; + int directories = int.Parse(args[2]); + string destinationDirectory = args[3]; + logger.LogInformation(sourceDirectory); + string[] subDirectories = directories == 1 ? [sourceDirectory] : Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly); + if (subDirectories.Length != directories) + throw new Exception($"{directories} != {subDirectories.Length}"); + foreach (string directory in subDirectories) + DirectoryToISO(logger, destinationDirectory, directory); + } + +} \ No newline at end of file diff --git a/Helpers/HelperVSCodePossibleExtension.cs b/Day/2024-Q1/Helper-2024-01-08.cs similarity index 93% rename from Helpers/HelperVSCodePossibleExtension.cs rename to Day/2024-Q1/Helper-2024-01-08.cs index da1b156..700af18 100644 --- a/Helpers/HelperVSCodePossibleExtension.cs +++ b/Day/2024-Q1/Helper-2024-01-08.cs @@ -2,9 +2,9 @@ using Microsoft.Extensions.Logging; using System.Collections.ObjectModel; using System.Text.RegularExpressions; -namespace File_Folder_Helper.Helpers; +namespace File_Folder_Helper.Day; -internal static partial class HelperVSCodePossibleExtension +internal static partial class Helper20240108 { private record Method(string Name, @@ -81,7 +81,7 @@ internal static partial class HelperVSCodePossibleExtension return result; } - private static int? GetFirstUsedLine(string[] lines, int i, string search, string searchNot, string searchWrap, int parameterCount) + private static int? GetFirstUsedLine(string[] lines, int i, string search, string searchNot, string searchWrap, string searchConstructor, int parameterCount) { int? result = null; string[] segments; @@ -99,7 +99,11 @@ internal static partial class HelperVSCodePossibleExtension { segments = lines[j].Split(searchWrap); if (segments.Length == 1) - continue; + { + segments = lines[j].Split(searchConstructor); + if (segments.Length == 1) + continue; + } } } lastSegmentBeforeDot = segments[^1].Split(").")[0]; @@ -147,6 +151,7 @@ internal static partial class HelperVSCodePossibleExtension int parameterCount; int? firstUsedLine; string lineSegmentFirst; + string searchConstructor; for (int i = 0; i < lines.Length; i++) { line = lines[i].Trim(); @@ -165,6 +170,7 @@ internal static partial class HelperVSCodePossibleExtension if (string.IsNullOrEmpty(name)) continue; blocks = 0; + searchConstructor = $"{name.ToLower()} = new("; startLine = GetStartLine(lines, i); parameterCount = GetParameterCount(line, search); isLinq = lines[i + 1].Trim() != "{"; @@ -184,7 +190,7 @@ internal static partial class HelperVSCodePossibleExtension endLine = j; if (lines.Length > j + 1 && string.IsNullOrEmpty(lines[j + 1].Trim())) endLine++; - firstUsedLine = GetFirstUsedLine(lines, i, search, searchNot, searchWrap, parameterCount); + firstUsedLine = GetFirstUsedLine(lines, i, search, searchNot, searchWrap, searchConstructor, parameterCount); if (firstUsedLine is null) { lineSegmentFirst = line.Split(search)[0]; @@ -249,7 +255,7 @@ internal static partial class HelperVSCodePossibleExtension return result; } - internal static void Sort(ILogger logger, List args) + internal static void SortCodeMethods(ILogger logger, List args) { bool result = false; bool check; diff --git a/Day/HelperDay.cs b/Day/HelperDay.cs index 610c7c5..344052c 100644 --- a/Day/HelperDay.cs +++ b/Day/HelperDay.cs @@ -34,6 +34,12 @@ internal static class HelperDay Day.Helper20231222.ConvertId(logger, args); else if (args[1] == "Day-Helper-2024-01-05") Day.Helper20240105.ConvertKeePassExport(logger, args); + else if (args[1] == "Day-Helper-2024-01-06") + Day.Helper20240106.TextToJson(logger, args); + else if (args[1] == "Day-Helper-2024-01-07") + Day.Helper20240107.DirectoryToISO(logger, args); + else if (args[1] == "Day-Helper-2024-01-08") + Day.Helper20240108.SortCodeMethods(logger, args); else throw new Exception(appSettings.Company); } diff --git a/File-Folder-Helper.csproj b/File-Folder-Helper.csproj index 81b1d4b..bf74ebf 100644 --- a/File-Folder-Helper.csproj +++ b/File-Folder-Helper.csproj @@ -8,9 +8,10 @@ eb9e8f58-fcb5-45bb-9d4d-54f064c485b1 - + + diff --git a/Helpers/HelperZipFilesBy.cs b/Helpers/HelperZipFilesBy.cs index 860d827..72ee792 100644 --- a/Helpers/HelperZipFilesBy.cs +++ b/Helpers/HelperZipFilesBy.cs @@ -8,9 +8,6 @@ namespace File_Folder_Helper.Helpers; internal static partial class HelperZipFilesBy { - [GeneratedRegex("[a-zA-Z0-9]{1,}")] - private static partial Regex LowerAlphaAlphaAndNumber(); - private static DateTimeOffset? GetDateTimeOffset(string keyFileExtension, FileInfo fileInfo, FileInfo extractKeyFileInfo) { DateTimeOffset? dateTimeOffset = null; @@ -31,6 +28,9 @@ internal static partial class HelperZipFilesBy return dateTimeOffset; } + [GeneratedRegex("[a-zA-Z0-9]{1,}")] + private static partial Regex LowerAlphaAlphaAndNumber(); + private static bool ExtractKeyFileAndSetDateFromZipEntry(ILogger logger, string[] zipFiles, string keyFileExtension, string keyFileExtensionB, string keyFileExtensionC, bool renameToLower) { bool result = false; @@ -120,6 +120,37 @@ internal static partial class HelperZipFilesBy return result; } + private static void ZipDirectory(ILogger logger, string directory) + { + logger.LogInformation("{directory}", directory); + string zipFile = $"{directory}.zip"; + int skipChars = directory.Length + 1; + string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories); + string[] directories = Directory.GetDirectories(directory, "*", SearchOption.AllDirectories); + ZipArchiveMode zipArchiveMode = File.Exists(zipFile) ? ZipArchiveMode.Update : ZipArchiveMode.Create; + for (int i = 1; i < 3; i++) + { + try + { + using ZipArchive zip = ZipFile.Open(zipFile, zipArchiveMode); + for (int j = 0; j < directories.Length; j++) + _ = zip.CreateEntry($"{directories[j][skipChars..]}/"); + foreach (string file in files) + { + _ = zip.CreateEntryFromFile(file, file[skipChars..]); + File.Delete(file); + } + break; + } + catch (Exception) + { + File.Delete(zipFile); + zipArchiveMode = ZipArchiveMode.Create; + } + } + Directory.Delete(directory, recursive: true); + } + internal static bool ZipFilesByDate(ILogger logger, string sourceDirectory, SearchOption searchOption = SearchOption.TopDirectoryOnly, string dayFormat = "") { bool result = false; @@ -291,37 +322,6 @@ internal static partial class HelperZipFilesBy return result; } - private static void ZipDirectory(ILogger logger, string directory) - { - logger.LogInformation("{directory}", directory); - string zipFile = $"{directory}.zip"; - int skipChars = directory.Length + 1; - string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories); - string[] directories = Directory.GetDirectories(directory, "*", SearchOption.AllDirectories); - ZipArchiveMode zipArchiveMode = File.Exists(zipFile) ? ZipArchiveMode.Update : ZipArchiveMode.Create; - for (int i = 1; i < 3; i++) - { - try - { - using ZipArchive zip = ZipFile.Open(zipFile, zipArchiveMode); - for (int j = 0; j < directories.Length; j++) - _ = zip.CreateEntry($"{directories[j][skipChars..]}/"); - foreach (string file in files) - { - _ = zip.CreateEntryFromFile(file, file[skipChars..]); - File.Delete(file); - } - break; - } - catch (Exception) - { - File.Delete(zipFile); - zipArchiveMode = ZipArchiveMode.Create; - } - } - Directory.Delete(directory, recursive: true); - } - internal static void ZipFilesByDirectoryWithFile(ILogger logger, string sourceDirectory) { string[] files1; diff --git a/Worker.cs b/Worker.cs index 33e8f13..dbdccf7 100644 --- a/Worker.cs +++ b/Worker.cs @@ -114,7 +114,7 @@ public class Worker : BackgroundService _Logger.LogInformation("S) Set Date from Zip Entry,"); _Logger.LogInformation("T) *Ticks ~~Too long rename~~,"); _Logger.LogInformation("U) Links for Hugo,"); - _Logger.LogInformation("V) VSCode Hope Sort,"); + // V // W _Logger.LogInformation("X) Day Helpers,"); _Logger.LogInformation("Y) Zip file(s) by directory with file,"); @@ -184,9 +184,6 @@ public class Worker : BackgroundService case ConsoleKey.U: Helpers.HelperMarkdown.MarkdownConvertLinksForHugo(_AppSettings, _Logger, _Args); break; - case ConsoleKey.V: - Helpers.HelperVSCodePossibleExtension.Sort(_Logger, _Args); - break; case ConsoleKey.X: Helpers.HelperDay.Select(_AppSettings, _Logger, _Args); break;