diff --git a/.vscode/launch.json b/.vscode/launch.json index 9e138e9..3c9d083 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,6 +11,12 @@ "preLaunchTask": "build", "program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll", "args": [ + "s", + "X", + "D:/0-ISO-A", + "Day-Helper-2025-06-28", + "*.iso", + "F", "s", "X", "D:/5-Other-Small", diff --git a/ADO2025/PI6/Helper-2025-06-28.cs b/ADO2025/PI6/Helper-2025-06-28.cs new file mode 100644 index 0000000..52a5670 --- /dev/null +++ b/ADO2025/PI6/Helper-2025-06-28.cs @@ -0,0 +1,47 @@ +using DiscUtils; +using DiscUtils.Iso9660; + +using Microsoft.Extensions.Logging; + +namespace File_Folder_Helper.ADO2025.PI6; + +internal static partial class Helper20250628 { + + private record File(long LastWriteTicks, + long Length, + string RelativePath); + + internal static void LogInformation(ILogger logger, List args) { + logger.LogInformation(args[0]); + logger.LogInformation(args[1]); + logger.LogInformation(args[2]); + string searchPattern = args[2]; + string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]); + string[] searchPatternFiles = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories); + LogInformation(logger, searchPatternFiles, args[3]); + } + + private static void LogInformation(ILogger logger, string[] searchPatternFiles, string letter) { + File file; + string[] files; + DiscFileInfo discFileInfo; + foreach (string searchPatternFile in searchPatternFiles) { + if (string.IsNullOrEmpty(searchPatternFile)) { + using FileStream fileStream = System.IO.File.OpenRead(searchPatternFile); + CDReader reader = new(fileStream, true); + files = reader.GetFiles("", "*"); + foreach (string f in files) { + discFileInfo = reader.GetFileInfo(f); + file = new(LastWriteTicks: discFileInfo.LastWriteTime.Ticks, Length: discFileInfo.Length, RelativePath: f); + } + } + logger.LogInformation("mountvol $driveLetter $volInfo.UniqueId"); + logger.LogInformation("$volInfo = $diskImg | Get-Volume"); + logger.LogInformation("$diskImg = Mount-DiskImage -ImagePath $isoImg -NoDriveLetter"); + logger.LogInformation($"$driveLetter = \"{letter}:\""); + logger.LogInformation($"$isoImg = \"{searchPatternFile}\""); + logger.LogInformation(string.Empty); + } + } + +} \ No newline at end of file diff --git a/Day/HelperDay.cs b/Day/HelperDay.cs index 5a1bfd0..4b661d6 100644 --- a/Day/HelperDay.cs +++ b/Day/HelperDay.cs @@ -171,6 +171,8 @@ internal static class HelperDay ADO2025.PI6.Helper20250602.EquipmentAutomationFrameworkCellInstanceStateImageVerbIf(logger, args); else if (args[1] == "Day-Helper-2025-06-18") ADO2025.PI6.Helper20250618.MoveAllButXOfEach(logger, args); + else if (args[1] == "Day-Helper-2025-06-28") + ADO2025.PI6.Helper20250628.LogInformation(logger, args); else throw new Exception(appSettings.Company); }