debug-proxy-pass (Day-Helper-2025-09-08)
This commit is contained in:
70
ADO2025/PI7/Helper-2025-09-08.cs
Normal file
70
ADO2025/PI7/Helper-2025-09-08.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace File_Folder_Helper.ADO2025.PI7;
|
||||
|
||||
internal static partial class Helper20250908 {
|
||||
|
||||
internal static void DebugProxyPass(ILogger<Worker> logger, List<string> args) {
|
||||
logger.LogInformation(args[0]);
|
||||
logger.LogInformation(args[1]);
|
||||
logger.LogInformation(args[2]);
|
||||
logger.LogInformation(args[3]);
|
||||
logger.LogInformation(args[4]);
|
||||
logger.LogInformation(args[5]);
|
||||
logger.LogInformation(args[6]);
|
||||
string debug;
|
||||
string domain;
|
||||
string[] lines;
|
||||
string[] files;
|
||||
string fileName;
|
||||
string[] segments;
|
||||
string[] segmentsB;
|
||||
string includePath = args[3];
|
||||
string searchString = args[4];
|
||||
string searchPattern = args[2];
|
||||
string searchStringBreak = args[6];
|
||||
string[] searchStrings = args[5].Split('~');
|
||||
string[] sourceDirectories = Path.GetFullPath(args[0]).Split('~');
|
||||
foreach (string sourceDirectory in sourceDirectories) {
|
||||
files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
|
||||
logger.LogInformation("With search pattern '{SearchPattern}' found {files} file(s)", searchPattern, files.Length);
|
||||
foreach (string file in files) {
|
||||
debug = string.Empty;
|
||||
domain = string.Empty;
|
||||
lines = File.ReadAllLines(file);
|
||||
fileName = Path.GetFileName(file);
|
||||
foreach (string line in lines) {
|
||||
if (line.Contains(searchStringBreak)) {
|
||||
if (!string.IsNullOrEmpty(domain)) {
|
||||
domain = $"{domain}/#has-{searchStringBreak}";
|
||||
}
|
||||
break;
|
||||
}
|
||||
segments = line.Split(searchString, StringSplitOptions.None);
|
||||
if (segments.Length > 1 && segments[1][0] is ' ' or '\t') {
|
||||
domain = segments[1].Trim().Trim(';');
|
||||
}
|
||||
segments = line.Split(searchStrings, StringSplitOptions.None);
|
||||
if (segments.Length < 2) {
|
||||
continue;
|
||||
}
|
||||
if (segments[1][0] is not ' ' and not '\t') {
|
||||
continue;
|
||||
}
|
||||
segmentsB = segments[1].Trim().TrimEnd(';').TrimEnd('/').Split(':');
|
||||
if (segmentsB.Length == 1 || string.IsNullOrEmpty(segmentsB[0]) || segmentsB[0][0] == '/') {
|
||||
debug = segmentsB[0];
|
||||
} else {
|
||||
debug = $"{segmentsB[0]}:{segmentsB[^1]}";
|
||||
}
|
||||
}
|
||||
logger.LogInformation("include {includePath}{fileName}; # https://{domain} # {debug}",
|
||||
includePath,
|
||||
fileName,
|
||||
domain,
|
||||
debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user