diff --git a/.vscode/launch.json b/.vscode/launch.json index a819ec8..2f187c8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,6 +11,18 @@ "preLaunchTask": "build", "program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll", "args": [ + "s", + "X", + "L:/DevOps/Mesa_FI/MesaFabApproval/Fab2ApprovalTests/Programmability/Functions", + "Day-Helper-2024-12-04", + "*.sql", + "333", + "444", + "555", + "666", + "777", + "888", + "999", "s", "X", "L:/DevOps/Mesa_FI/MesaFabApproval", diff --git a/ADO2024/PI4/Helper-2024-12-04.cs b/ADO2024/PI4/Helper-2024-12-04.cs new file mode 100644 index 0000000..c1e09eb --- /dev/null +++ b/ADO2024/PI4/Helper-2024-12-04.cs @@ -0,0 +1,24 @@ +using Microsoft.Extensions.Logging; +using System.Text; + +namespace File_Folder_Helper.ADO2024.PI4; + +internal static partial class Helper20241204 +{ + + internal static void ConvertToUTF8(ILogger logger, List args) + { + string text; + string searchPattern = args[2]; + string sourceDirectory = Path.GetFullPath(args[0]); + string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.TopDirectoryOnly); + if (files.Length == 0) + logger.LogError("No files found in {sourceDirectory} with search pattern {searchPattern}", sourceDirectory, searchPattern); + foreach (string file in files) + { + text = File.ReadAllText(file); + File.WriteAllText(file, text, Encoding.UTF8); + } + } + +} \ No newline at end of file diff --git a/Day/HelperDay.cs b/Day/HelperDay.cs index a83bb5c..ad06c53 100644 --- a/Day/HelperDay.cs +++ b/Day/HelperDay.cs @@ -119,6 +119,8 @@ internal static class HelperDay ADO2024.PI4.Helper20241108.WriteMarkdown(logger, args); else if (args[1] == "Day-Helper-2024-11-15") ADO2024.PI4.Helper20241115.GetComplete(logger, args); + else if (args[1] == "Day-Helper-2024-12-04") + ADO2024.PI4.Helper20241204.ConvertToUTF8(logger, args); else throw new Exception(appSettings.Company); }