43 lines
1.7 KiB
C#
43 lines
1.7 KiB
C#
using Microsoft.Extensions.Logging;
|
|
namespace File_Folder_Helper.ADO2024.PI3;
|
|
|
|
internal static partial class Helper20240916
|
|
{
|
|
|
|
internal static void DebugProxyPass(ILogger<Worker> logger, List<string> args)
|
|
{
|
|
string debug;
|
|
string[] lines;
|
|
string[] segments;
|
|
string domain = args[5];
|
|
string includePath = args[3];
|
|
string searchPattern = args[2];
|
|
string fileNameWithoutExtension;
|
|
string[] searchPatterns = args[4].Split('|');
|
|
string sourceDirectory = Path.GetFullPath(args[0]);
|
|
string[] 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;
|
|
lines = File.ReadAllLines(file);
|
|
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
|
foreach (string line in lines)
|
|
{
|
|
segments = line.Split(searchPatterns, StringSplitOptions.None);
|
|
if (segments.Length < 2)
|
|
continue;
|
|
if (segments[1][0] is not ' ' and not '\t')
|
|
continue;
|
|
debug = segments[1].Trim();
|
|
}
|
|
logger.LogInformation("{includePath}{fileNameWithoutExtension}; # https://{fileNameWithoutExtension}.{domain} # {debug}",
|
|
includePath,
|
|
fileNameWithoutExtension,
|
|
fileNameWithoutExtension,
|
|
domain,
|
|
debug);
|
|
}
|
|
}
|
|
|
|
} |