InfinityQS
This commit is contained in:
parent
59231ad9e2
commit
03ada95fbb
16
.vscode/launch.json
vendored
16
.vscode/launch.json
vendored
@ -13,12 +13,16 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"s",
|
"s",
|
||||||
"X",
|
"X",
|
||||||
"D:/5-Other-Small/Kanban-messa010ec/Kanban/Work-Items",
|
"\\\\messa04ec.infineon.com\\EC_SPC_Si\\SPC\\Projects\\Active",
|
||||||
"Day-Helper-2024-09-11",
|
"Day-Helper-2024-09-25",
|
||||||
"*.json",
|
"*.ipj",
|
||||||
".kanbn",
|
"=TEST,",
|
||||||
"Epic|Feature|User Story",
|
"L:/DevOps/Mesa_FI/File-Folder-Helper/.vscode/helper/iqs",
|
||||||
"L:/DevOps/Mesa_FI/File-Folder-Helper/.vscode/helper/tfs"
|
"555",
|
||||||
|
"666",
|
||||||
|
"777",
|
||||||
|
"888",
|
||||||
|
"999"
|
||||||
],
|
],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
|
@ -109,6 +109,8 @@ internal static class HelperDay
|
|||||||
Day.Q32024.Helper20240911.WriteMarkdown(logger, args);
|
Day.Q32024.Helper20240911.WriteMarkdown(logger, args);
|
||||||
else if (args[1] == "Day-Helper-2024-09-16")
|
else if (args[1] == "Day-Helper-2024-09-16")
|
||||||
Day.Q32024.Helper20240916.DebugProxyPass(logger, args);
|
Day.Q32024.Helper20240916.DebugProxyPass(logger, args);
|
||||||
|
else if (args[1] == "Day-Helper-2024-09-25")
|
||||||
|
Day.Q32024.Helper20240925.DistinctTests(logger, args);
|
||||||
else
|
else
|
||||||
throw new Exception(appSettings.Company);
|
throw new Exception(appSettings.Company);
|
||||||
}
|
}
|
||||||
|
65
Day/Q32024/Helper-2024-09-25.cs
Normal file
65
Day/Q32024/Helper-2024-09-25.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
namespace File_Folder_Helper.Day.Q32024;
|
||||||
|
|
||||||
|
internal static partial class Helper20240925
|
||||||
|
{
|
||||||
|
|
||||||
|
public record Test(string Name,
|
||||||
|
long Value);
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(ReadOnlyCollection<Test>))]
|
||||||
|
internal partial class TestCollectionSourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ReadOnlyCollection<Test> GetTests(string sourceDirectory, string searchPattern, string searchPatternB)
|
||||||
|
{
|
||||||
|
List<Test> results = [];
|
||||||
|
long test;
|
||||||
|
string[] lines;
|
||||||
|
string[] segments;
|
||||||
|
string[] segmentsB;
|
||||||
|
List<long> distinct = [];
|
||||||
|
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
lines = File.ReadAllLines(file);
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
segments = line.Split(searchPatternB);
|
||||||
|
if (segments.Length < 2)
|
||||||
|
continue;
|
||||||
|
segmentsB = segments[1].Split(',');
|
||||||
|
if (segmentsB.Length < 2)
|
||||||
|
continue;
|
||||||
|
if (!long.TryParse(segmentsB[0], out test))
|
||||||
|
continue;
|
||||||
|
if (distinct.Contains(test))
|
||||||
|
continue;
|
||||||
|
distinct.Add(test);
|
||||||
|
results.Add(new(segmentsB[1].Trim('"'), test));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (from l in results orderby l.Name.Length, l.Name select l).ToArray().AsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void DistinctTests(ILogger<Worker> logger, List<string> args)
|
||||||
|
{
|
||||||
|
string searchPattern = args[2];
|
||||||
|
string searchPatternB = args[3];
|
||||||
|
string destinationDirectory = args[4];
|
||||||
|
string sourceDirectory = Path.GetFullPath(args[0]);
|
||||||
|
if (!Directory.Exists(destinationDirectory))
|
||||||
|
_ = Directory.CreateDirectory(destinationDirectory);
|
||||||
|
ReadOnlyCollection<Test> tests = GetTests(sourceDirectory, searchPattern, searchPatternB);
|
||||||
|
logger.LogInformation("Found {files} file(s)", tests.Count);
|
||||||
|
string json = JsonSerializer.Serialize(tests, TestCollectionSourceGenerationContext.Default.ReadOnlyCollectionTest);
|
||||||
|
string fileName = Path.Combine(destinationDirectory, ".json");
|
||||||
|
File.WriteAllText(fileName, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user