log-information (Day-Helper-2025-06-28)
This commit is contained in:
47
ADO2025/PI6/Helper-2025-06-28.cs
Normal file
47
ADO2025/PI6/Helper-2025-06-28.cs
Normal file
@ -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<Worker> logger, List<string> 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<Worker> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user