ConvertToUTF8
This commit is contained in:
parent
ec98d1e275
commit
cf531cff36
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -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",
|
||||
|
24
ADO2024/PI4/Helper-2024-12-04.cs
Normal file
24
ADO2024/PI4/Helper-2024-12-04.cs
Normal file
@ -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<Worker> logger, List<string> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user