CDE
Use of LinkTarget
This commit is contained in:
Mike Phares 2024-11-01 17:08:04 -07:00
parent e26c4ccf31
commit f0ebc5b574
10 changed files with 1373 additions and 23666 deletions

19
.vscode/launch.json vendored
View File

@ -11,6 +11,25 @@
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
"args": [
"s",
"X",
"D:/Tmp/phares/Production__v2_57_0__HGCV1__pcl__Normal",
"Day-Helper-2024-10-30",
"*.txt",
"s",
"X",
"D:/Tmp/phares/Production__v2_57_0__CDE6__RsM__Normal",
"Day-Helper-2024-10-31",
"*.RsM",
"s",
"X",
"L:/DevOps/Mesa_FI/File-Folder-Helper/.vscode/helper/tfs",
"Day-Helper-2024-09-11",
"https://eaf-dev.mes.infineon.com/json/work-items.json?v=2024-10-04-08-34&_=1728333679350",
"https://oi-metrology-viewer-prod.mes.infineon.com/json/work-items.json?v=2024-10-07-10-09&_=1728336047608",
"Epic|Feature|User Story",
"https://tfs.intra.infineon.com/tfs/FactoryIntegration/ART%20SPS/_workitems/edit/",
"L:/DevOps/Mesa_FI/File-Folder-Helper/.vscode/helper/tfs",
"D:/5-Other-Small/Proxmox/exiftool/286628400329.jpg.jpg",
"s",
"X",

6
.vscode/mklink.md vendored
View File

@ -18,9 +18,9 @@ mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.kanbn" "D:\5-Other-Small\Kanban
del "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode"
del "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-oss"
del "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-insiders"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode" "C:\Users\phares\.vscode\extensions\ifx.type-script-helper-1.6.3"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-oss" "C:\Users\phares\.vscode-oss\extensions\ifx.type-script-helper-1.6.3"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-insiders" "C:\Users\phares\.vscode-insiders\extensions\ifx.type-script-helper-1.6.3"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode" "C:\Users\phares\.vscode\extensions\ifx.type-script-helper-1.7.0"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-oss" "C:\Users\phares\.vscode-oss\extensions\ifx.type-script-helper-1.7.0"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-insiders" "C:\Users\phares\.vscode-insiders\extensions\ifx.type-script-helper-1.7.0"
```
```bash Thu Jul 18 2024 13:47:40 GMT-0700 (Mountain Standard Time)

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
#if WorkItems
using File_Folder_Helper.ADO2024.PI3.WorkItems;
#endif
using Microsoft.Extensions.Logging;
#if WorkItems
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
@ -9,12 +11,15 @@ using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Web;
#endif
namespace File_Folder_Helper.ADO2024.PI3;
internal static partial class Helper20240830
{
#if WorkItems
private record WorkItem(string AreaPath,
string? AssignedTo,
int? BusinessValue,
@ -232,5 +237,14 @@ internal static partial class Helper20240830
CompareWorkItems(workItemTrackingHttpClient, targetFileLocation, project, site, valueWithReqCollection);
}
}
#endif
#else
internal static void CompareWorkItems(ILogger<Worker> logger, List<string> args)
{
logger.LogError("CompareWorkItems is not available in WorkItems {args[0]}", args[0]);
logger.LogError("CompareWorkItems is not available in WorkItems {args[1]}", args[1]);
}
#endif
}

View File

@ -0,0 +1,47 @@
using Microsoft.Extensions.Logging;
using System.Collections.ObjectModel;
namespace File_Folder_Helper.ADO2024.PI3;
internal static partial class Helper20241029
{
private static ReadOnlyCollection<string> GetFibonacci(int length)
{
List<string> results = [];
int[] fibonacci =
[
1, // x-small
2, // small
3, // medium
5, // large
8, // x-large
13, // xx-large
20 // xxx-large
];
double factor = Math.Floor((double)(length / fibonacci.Length));
double sort = Math.Round(1 / factor, 6) - 0.001;
for (int j = 0; j < fibonacci.Length; j++)
{
results.Add((fibonacci[j] * 1000).ToString());
for (int i = 0; i < factor; i++)
results.Add(((int)Math.Round((fibonacci[j] + ((i + 1) * sort)) * 1000)).ToString());
}
if (results.Count < length)
throw new Exception();
results.Reverse();
return new(results);
}
internal static void GetFibonacci(ILogger<Worker> logger, List<string> args)
{
int length = int.Parse(args[2]);
ReadOnlyCollection<string> collection;
for (int i = 1; i < 200; i++)
_ = GetFibonacci(i);
collection = GetFibonacci(length);
foreach (string fibonacci in collection)
logger.LogInformation(fibonacci);
File.WriteAllText(".vscode/helper/.txt", string.Join(Environment.NewLine, collection));
}
}

View File

@ -0,0 +1,429 @@
using Microsoft.Extensions.Logging;
#if HgCV
using System.Collections.ObjectModel;
using System.Text.Json;
using System.Text.Json.Serialization;
#endif
namespace File_Folder_Helper.ADO2024.PI3;
internal static partial class Helper20241030
{
#if HgCV
private record Complete(Header Header, Summary Summary, ReadOnlyCollection<Point> Points)
{
internal static Complete? Get(int take, string site, string multiple, string summaryLine, string lastUnits, string lastUnitsB, ReadOnlyCollection<string> lines)
{
Complete? result;
Header? header = Header.Get(lines, site, summaryLine);
if (header is null)
result = null;
else
{
Summary? summary = SummarySegment.Get(lines, site, summaryLine, lastUnits);
if (summary is null)
result = null;
else
{
ReadOnlyCollection<Point> points = Point.GetCollection(lines, take, site, multiple, summaryLine, lastUnitsB) ?? throw new NullReferenceException(nameof(summary));
if (points.Count == 0)
result = null;
else
result = new(header, summary, points);
}
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Complete))]
private partial class CompleteSourceGenerationContext : JsonSerializerContext
{
}
private record Header([property: JsonPropertyName("Operator")] string Operator,
[property: JsonPropertyName("Start Voltage")] string StartVoltage,
[property: JsonPropertyName("Wafer")] string Wafer,
[property: JsonPropertyName("Stop Voltage")] string StopVoltage,
[property: JsonPropertyName("Lot")] string Lot,
[property: JsonPropertyName("Ramp Rate")] string RampRate,
[property: JsonPropertyName("Plan")] string Plan,
[property: JsonPropertyName("G limit")] string GLimit,
[property: JsonPropertyName("Date")] string Date,
[property: JsonPropertyName("Time")] string Time,
[property: JsonPropertyName("Setup File")] string SetupFile,
[property: JsonPropertyName("Wafer size")] string WaferSize,
[property: JsonPropertyName("Folder")] string Folder,
[property: JsonPropertyName("Ccomp")] string Ccomp,
[property: JsonPropertyName("Pattern")] string Pattern,
[property: JsonPropertyName("Area")] string Area,
[property: JsonPropertyName("Cond Type")] string CondType,
[property: JsonPropertyName("Rho Method")] string RhoMethod,
[property: JsonPropertyName("Model")] string Model)
{
private static string[] GetRemove() =>
[
" L L",
" O O",
" G G",
" C C",
" O O",
" N N",
" C C",
" E E",
" N N",
" T T",
" R R",
" A A",
" T T",
" I I",
" O O",
" N N"
];
internal static Header Get() =>
new(string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
private static ReadOnlyCollection<JsonProperty> GetJsonProperties()
{
JsonProperty[] results;
string json;
Header header = Get();
json = JsonSerializer.Serialize(header);
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
results = jsonElement.EnumerateObject().ToArray();
return new(results);
}
internal static Header? Get(ReadOnlyCollection<string> lines, string site, string summaryLine)
{
Header? result;
string json;
string check;
string[] segments;
string[] segmentsB;
string[] segmentsC;
bool found = false;
string[] remove = GetRemove();
Dictionary<string, string> keyValuePairs = [];
ReadOnlyCollection<JsonProperty> jsonProperties = GetJsonProperties();
foreach (string line in lines)
{
if (line.Contains(site))
found = true;
if (!found)
continue;
if (line == summaryLine)
break;
foreach (JsonProperty jsonProperty in jsonProperties)
{
segments = line.Split([$"{jsonProperty.Name}:", $"{jsonProperty.Name} :"], StringSplitOptions.None);
if (segments.Length < 2)
continue;
check = segments[1].Trim();
foreach (JsonProperty jsonPropertyB in jsonProperties)
{
segmentsB = check.Split([$"{jsonPropertyB.Name}:", $"{jsonPropertyB.Name} :"], StringSplitOptions.None);
if (segmentsB.Length > 1)
check = segmentsB[0].Trim();
}
foreach (string r in remove)
{
segmentsC = check.Split(r);
if (segmentsC.Length > 1)
check = segmentsC[0].Trim();
}
keyValuePairs.Add(jsonProperty.Name, check);
}
}
if (keyValuePairs.Count != jsonProperties.Count)
result = null;
else
{
json = JsonSerializer.Serialize(keyValuePairs);
result = JsonSerializer.Deserialize(json, HeaderSourceGenerationContext.Default.Header) ?? throw new NullReferenceException(nameof(result));
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Header))]
private partial class HeaderSourceGenerationContext : JsonSerializerContext
{
}
private record Summary(SummarySegment? Mean, SummarySegment? StandardDeviationPercentage, SummarySegment? RadialGradient);
private record SummarySegment([property: JsonPropertyName("Navg")] string NAvg,
[property: JsonPropertyName("Nsl")] string Nsl,
[property: JsonPropertyName("Vd")] string Vd,
[property: JsonPropertyName("Flat Z")] string FlatZ,
[property: JsonPropertyName("Rhoavg")] string RhoAvg,
[property: JsonPropertyName("Rhosl")] string Rhosl,
[property: JsonPropertyName("Phase")] string Phase,
[property: JsonPropertyName("Grade")] string Grade,
[property: JsonPropertyName("@ Rs")] string Rs)
{
internal static SummarySegment Get() =>
new(string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
private static ReadOnlyCollection<JsonProperty> GetJsonProperties()
{
JsonProperty[] results;
string json;
SummarySegment summarySegment = Get();
json = JsonSerializer.Serialize(summarySegment);
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
results = jsonElement.EnumerateObject().ToArray();
return new(results);
}
internal static Summary? Get(ReadOnlyCollection<string> lines, string site, string summaryLine, string lastUnits)
{
Summary? result;
string json;
string[] segments;
bool found = false;
string[] segmentsB;
Dictionary<string, string> keyValuePairs = [];
Dictionary<string, string> keyValuePairsB = [];
Dictionary<string, string> keyValuePairsC = [];
ReadOnlyCollection<JsonProperty> jsonProperties = GetJsonProperties();
foreach (string line in lines)
{
if (line == summaryLine)
found = true;
if (!found)
continue;
if (line.Contains(site))
break;
if (line.Contains(lastUnits))
break;
foreach (JsonProperty jsonProperty in jsonProperties)
{
segments = line.Split([$"{jsonProperty.Name}:", $"{jsonProperty.Name} :"], StringSplitOptions.None);
if (segments.Length < 2 || (!line.StartsWith(jsonProperty.Name) && !line.StartsWith($"@ {jsonProperty.Name}")))
continue;
segmentsB = segments[1].Trim().Split(' ');
if (segmentsB.Length < 3)
continue;
keyValuePairs.Add(jsonProperty.Name, segmentsB[0]);
keyValuePairsB.Add(jsonProperty.Name, segmentsB[1]);
keyValuePairsC.Add(jsonProperty.Name, segmentsB[2]);
}
}
if (keyValuePairs.Count != jsonProperties.Count || keyValuePairsB.Count != jsonProperties.Count || keyValuePairsC.Count != jsonProperties.Count)
result = null;
else
{
json = JsonSerializer.Serialize(keyValuePairs);
SummarySegment? mean = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
json = JsonSerializer.Serialize(keyValuePairsB);
SummarySegment? standardDeviationPercentage = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
json = JsonSerializer.Serialize(keyValuePairsC);
SummarySegment? radialGradient = JsonSerializer.Deserialize(json, SummarySegmentSourceGenerationContext.Default.SummarySegment);
result = new(mean, standardDeviationPercentage, radialGradient);
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(SummarySegment))]
private partial class SummarySegmentSourceGenerationContext : JsonSerializerContext
{
}
private record Point([property: JsonPropertyName("Site")] string Site,
[property: JsonPropertyName("X")] string X,
[property: JsonPropertyName("Y")] string Y,
[property: JsonPropertyName("Navg")] string NAvg,
[property: JsonPropertyName("Rhoavg")] string RhoAvg,
[property: JsonPropertyName("Nsl")] string Nsl,
[property: JsonPropertyName("Rhosl")] string Rhosl,
[property: JsonPropertyName("Vd")] string Vd,
[property: JsonPropertyName("Phase")] string Phase,
[property: JsonPropertyName("Flat Z")] string FlatZ,
[property: JsonPropertyName("Grade")] string Grade,
[property: JsonPropertyName("X Left")] string XLeft,
[property: JsonPropertyName("X Right")] string XRight,
[property: JsonPropertyName("Bottom Y")] string BottomY,
[property: JsonPropertyName("Top Y")] string TopY)
{
internal static Point Get() =>
new(string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
internal static ReadOnlyCollection<Point> GetCollection(ReadOnlyCollection<string> lines, int take, string site, string multiple, string summaryLine, string lastUnitsB)
{
List<Point> results = [];
string s;
string line;
Point point;
string[] segments;
string[] segmentsB;
bool found = false;
bool foundB = false;
string[] segmentsC;
List<string> sites = [];
for (int i = 0; i < lines.Count; i++)
{
line = lines[i];
segmentsC = line.Split(site, StringSplitOptions.RemoveEmptyEntries);
if (segmentsC.Length > 1)
{
foreach (string segment in segmentsC)
sites.Add(segment.Trim());
}
if (line == summaryLine)
{
sites.RemoveAt(0);
found = true;
}
if (!found)
continue;
if (!foundB && line.Contains(multiple))
foundB = true;
if (line != lastUnitsB)
continue;
if (foundB)
{
foundB = false;
continue;
}
for (int j = 0; j < sites.Count; j++)
{
s = sites[j];
if (i + take > lines.Count)
break;
segments = s.Split(["(", ",", ")"], StringSplitOptions.None);
if (segments.Length < 2)
break;
segmentsB = lines[i + 10].Split(' ');
if (segmentsB.Length < 2)
break;
point = new(segments[0].Trim(),
segments[1].Trim(),
segments[2].Trim(),
NAvg: lines[i + 2].Trim(),
Nsl: lines[i + 3].Trim(),
Vd: lines[i + 4].Trim(),
FlatZ: lines[i + 5].Trim(),
RhoAvg: lines[i + 6].Trim(),
Rhosl: lines[i + 7].Trim(),
Phase: lines[i + 8].Trim(),
Grade: lines[i + 9].Trim(),
XLeft: segmentsB[0],
XRight: segmentsB[1],
BottomY: lines[i + 11].Trim(),
TopY: lines[i + 12].Trim());
results.Add(point);
i += take;
}
sites.Clear();
}
return new(results);
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Point))]
private partial class PointSourceGenerationContext : JsonSerializerContext
{
}
internal static void GetComplete(ILogger<Worker> logger, List<string> args)
{
string searchPattern = args[2];
string sourceDirectory = Path.GetFullPath(args[0]);
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (files.Length != 1)
logger.LogError("No files found in {sourceDirectory} with search pattern {searchPattern}", sourceDirectory, searchPattern);
else
{
const int take = 12;
string[] lines = File.ReadAllLines(files[0]);
ReadOnlyCollection<string> collection = new(lines);
if (collection.Count < take)
logger.LogError("File {files[0]} has less than {take} lines", files[0], take);
else
{
const string site = "Site: ";
const string multiple = "MULTIPLE";
const string summaryLine = "SUMMARY A A";
const string lastUnits = "Flat Z: Grade : % Flat Z: Grade : %";
const string lastUnitsB = "Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %";
Complete? complete = Complete.Get(take, site, multiple, summaryLine, lastUnits, lastUnitsB, collection);
if (complete is null)
logger.LogError("Could not get Complete from {files[0]}", files[0]);
else
{
string json = JsonSerializer.Serialize(complete, CompleteSourceGenerationContext.Default.Complete);
File.WriteAllText($"{files[0]}.json", json);
}
}
}
}
#else
internal static void GetComplete(ILogger<Worker> logger, List<string> args)
{
logger.LogError("GetComplete is not available in CDE {args[0]}", args[0]);
logger.LogError("GetComplete is not available in CDE {args[1]}", args[1]);
}
#endif
}

View File

@ -0,0 +1,555 @@
using Microsoft.Extensions.Logging;
#if CDE
using System.Collections.ObjectModel;
using System.Text.Json;
using System.Text.Json.Serialization;
#endif
namespace File_Folder_Helper.ADO2024.PI3;
internal static partial class Helper20241031
{
#if CDE
private record Complete(Line1 Line1, Line2 Line2, Line3 Line3, Line4 Line4, Line4B Line4B, Line5 Line5, Line6 Line6, Line7 Line7, Line8 Line8, Line9 Line9, Line10 Line10, Line11 Line11, Line12 Line12, Line13 Line13, Point[] Points)
{
internal static ReadOnlyCollection<string> GetCollection(string[] segments)
{
List<string> results = [];
foreach (string segment in segments)
{
if (segment[0] == ',')
break;
results.Add(segment);
}
return new(results);
}
internal static Complete? Get(int take, ReadOnlyCollection<string> lines)
{
Complete? result;
if (lines.Count < take)
result = null;
else
{
string[] separator = [" ", "\t"];
// <Title>
Line1 line1 = Line1.Get(lines[0].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <FileName, Proj,Rcpe, LotID,WfrID, Is_TF_DataFile>
Line2 line2 = Line2.Get(lines[1].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <Directory>
Line3 line3 = Line3.Get(lines[2].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <DateTime,Temp,TCR%,N|P>
Line4 line4 = Line4.Get(lines[3].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <Avg,Dev,Min,Max>
Line4B? line4B = Line4B.Get(lines[3].Split([">"], StringSplitOptions.RemoveEmptyEntries));
if (line4B is null)
result = null;
else
{
// <Operator, Epuipment>
Line5 line5 = Line5.Get(lines[4].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <Engineer>
Line6 line6 = Line6.Get(lines[5].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <AreaOrDiamScan, WaferShape, dNBand, TemplateFile, xsize,ysize, CalibFactor, MsmtMode, DataType, DataUnit>
Line7 line7 = Line7.Get(lines[6].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <NumProbePoints, SingleOrDualProbeConfig, #ActPrbPts, Rsens,IdrvMx,VinGain, DataRejectSigma, MeritThreshold, PrbChg#, PrbName>
Line8 line8 = Line8.Get(lines[7].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <WaferSize,EdgeEx, x,yll, x,yur, #x,y, CutCorners>
Line9 line9 = Line9.Get(lines[8].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <Diam: ThScan Start End Step>
Line10 line10 = Line10.Get(lines[9].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <FlatOrNotch FollowMajorFlat AutoOrManualLoad RangeOrIndvdual PauseAfterEveryRun, AutoPrint,Plot, BulkSmplThk & Unit>
Line11 line11 = Line11.Get(lines[10].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <RangeFrom, RangeTo>
Line12 line12 = Line12.Get(lines[11].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <CassSlotSelected>
Line13 line13 = Line13.Get(lines[12].Split(separator, StringSplitOptions.RemoveEmptyEntries));
// <R,Th,Data, Rs,RsA,RsB, #Smpl, x,y, Irng,Vrng, ChiSq,merit/GOF, DataIntegrity>
ReadOnlyCollection<Point> points = Point.Get(take, lines, separator);
if (points.Count == 0)
result = null;
else
result = new(line1, line2, line3, line4, line4B, line5, line6, line7, line8, line9, line10, line11, line12, line13, points.ToArray());
}
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Complete))]
private partial class CompleteSourceGenerationContext : JsonSerializerContext
{
}
private record Line1([property: JsonPropertyName("Title")] string Title)
{
internal static Line1 Get(string[] segments)
{
Line1 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line1))]
private partial class Line1SourceGenerationContext : JsonSerializerContext
{
}
private record Line2([property: JsonPropertyName("FileName")] string FileName,
[property: JsonPropertyName("Proj")] string Project,
[property: JsonPropertyName("Rcpe")] string RecipeName,
[property: JsonPropertyName("LotID")] string LotID,
[property: JsonPropertyName("WfrID")] string WfrID,
[property: JsonPropertyName("Is_TF_DataFile")] string Is_TF_DataFile)
{
internal static Line2 Get(string[] segments)
{
Line2 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4],
collection.Count < 6 ? string.Empty : collection[5]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line2))]
private partial class Line2SourceGenerationContext : JsonSerializerContext
{
}
private record Line3([property: JsonPropertyName("Directory")] string Directory)
{
internal static Line3 Get(string[] segments)
{
Line3 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line3))]
private partial class Line3SourceGenerationContext : JsonSerializerContext
{
}
private record Line4([property: JsonPropertyName("Time")] string Time,
[property: JsonPropertyName("Date")] string Date,
[property: JsonPropertyName("Temp")] string Temp,
[property: JsonPropertyName("TCR%")] string TCRPercent,
[property: JsonPropertyName("N|P")] string NOrP)
{
internal static Line4 Get(string[] segments)
{
Line4 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line4))]
private partial class Line4SourceGenerationContext : JsonSerializerContext
{
}
private record Line4B([property: JsonPropertyName("Avg")] string Avg,
[property: JsonPropertyName("Dev")] string Dev,
[property: JsonPropertyName("Min")] string Min,
[property: JsonPropertyName("Max")] string Max)
{
internal static Line4B? Get(string[] segments)
{
Line4B? result;
if (segments.Length < 2)
result = null;
else
{
string[] segmentsB = segments[1].Split([" "], StringSplitOptions.RemoveEmptyEntries);
result = new(segmentsB.Length < 2 ? string.Empty : segmentsB[1],
segmentsB.Length < 4 ? string.Empty : segmentsB[3],
segmentsB.Length < 6 ? string.Empty : segmentsB[5],
segmentsB.Length < 8 ? string.Empty : segmentsB[7]);
}
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line4B))]
private partial class Line4BSourceGenerationContext : JsonSerializerContext
{
}
private record Line5([property: JsonPropertyName("Operator")] string Operator,
[property: JsonPropertyName("Epuipment")] string Equipment)
{
internal static Line5 Get(string[] segments)
{
Line5 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line5))]
private partial class Line5SourceGenerationContext : JsonSerializerContext
{
}
private record Line6([property: JsonPropertyName("Engineer")] string Engineer)
{
internal static Line6 Get(string[] segments)
{
Line6 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line6))]
private partial class Line6SourceGenerationContext : JsonSerializerContext
{
}
private record Line7([property: JsonPropertyName("AreaOrDiamScan")] string AreaOrDiamScan,
[property: JsonPropertyName("WaferShape")] string WaferShape,
[property: JsonPropertyName("dNBand")] string BNBand,
[property: JsonPropertyName("TemplateFile")] string TemplateFile,
[property: JsonPropertyName("xsize")] string XSize,
[property: JsonPropertyName("ysize")] string YSize,
[property: JsonPropertyName("CalibFactor")] string CalibrationFactor,
[property: JsonPropertyName("MsmtMode")] string MsmtMode,
[property: JsonPropertyName("DataType")] string DataType,
[property: JsonPropertyName("DataUnit")] string DataUnit)
{
internal static Line7 Get(string[] segments)
{
Line7 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4],
collection.Count < 6 ? string.Empty : collection[5],
collection.Count < 7 ? string.Empty : collection[6],
collection.Count < 8 ? string.Empty : collection[7],
collection.Count < 9 ? string.Empty : collection[8],
collection.Count < 10 ? string.Empty : collection[9]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line7))]
private partial class Line7SourceGenerationContext : JsonSerializerContext
{
}
private record Line8([property: JsonPropertyName("NumProbePoints")] string NumProbePoints,
[property: JsonPropertyName("SingleOrDualProbeConfig")] string SingleOrDualProbeConfig,
[property: JsonPropertyName("#ActPrbPts")] string NumberActPrbPts,
[property: JsonPropertyName("Rsens")] string Rsens,
[property: JsonPropertyName("IdrvMx")] string IdrvMx,
[property: JsonPropertyName("VinGain")] string VinGain,
[property: JsonPropertyName("DataRejectSigma")] string DataRejectSigma,
[property: JsonPropertyName("MeritThreshold")] string MeritThreshold,
[property: JsonPropertyName("PrbChg#")] string PrbChgNumber,
[property: JsonPropertyName("PrbName")] string PrbName)
{
internal static Line8 Get(string[] segments)
{
Line8 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4],
collection.Count < 6 ? string.Empty : collection[5],
collection.Count < 7 ? string.Empty : collection[6],
collection.Count < 8 ? string.Empty : collection[7],
collection.Count < 9 ? string.Empty : collection[8],
collection.Count < 10 ? string.Empty : collection[9]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line8))]
private partial class Line8SourceGenerationContext : JsonSerializerContext
{
}
private record Line9([property: JsonPropertyName("WaferSize")] string WaferSize,
[property: JsonPropertyName("EdgeEx")] string EdgeEx,
[property: JsonPropertyName("xll")] string Xll,
[property: JsonPropertyName("yll")] string Yll,
[property: JsonPropertyName("xur")] string Xur,
[property: JsonPropertyName("yur")] string Yur,
[property: JsonPropertyName("x")] string X,
[property: JsonPropertyName("y")] string Y,
[property: JsonPropertyName("CutCorners")] string CutCorners)
{
internal static Line9 Get(string[] segments)
{
Line9 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4],
collection.Count < 6 ? string.Empty : collection[5],
collection.Count < 7 ? string.Empty : collection[6],
collection.Count < 8 ? string.Empty : collection[7],
collection.Count < 9 ? string.Empty : collection[8]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line9))]
private partial class Line9SourceGenerationContext : JsonSerializerContext
{
}
private record Line10([property: JsonPropertyName("Diam ThScan")] string DiamThScan,
[property: JsonPropertyName("Diam Start")] string DiamStart,
[property: JsonPropertyName("Diam End")] string DiamEnd,
[property: JsonPropertyName("Diam Step")] string DiamStep)
{
internal static Line10 Get(string[] segments)
{
Line10 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line10))]
private partial class Line10SourceGenerationContext : JsonSerializerContext
{
}
private record Line11([property: JsonPropertyName("FlatOrNotch")] string FlatOrNotch,
[property: JsonPropertyName("FollowMajorFlat")] string FollowMajorFlat,
[property: JsonPropertyName("AutoOrManualLoad")] string AutoOrManualLoad,
[property: JsonPropertyName("RangeOrIndvdual")] string RangeOrIndividual,
[property: JsonPropertyName("PauseAfterEveryRun")] string PauseAfterEveryRun,
[property: JsonPropertyName("AutoPrint")] string AutoPrint,
[property: JsonPropertyName("Plot")] string Plot,
[property: JsonPropertyName("BulkSmplThk")] string BulkSampleThk,
[property: JsonPropertyName("Unit")] string Unit)
{
internal static Line11 Get(string[] segments)
{
Line11 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4],
collection.Count < 6 ? string.Empty : collection[5],
collection.Count < 7 ? string.Empty : collection[6],
collection.Count < 8 ? string.Empty : collection[7],
collection.Count < 9 ? string.Empty : collection[8]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line11))]
private partial class Line11SourceGenerationContext : JsonSerializerContext
{
}
private record Line12([property: JsonPropertyName("RangeFrom")] string RangeFrom,
[property: JsonPropertyName("RangeTo")] string RangeTo)
{
internal static Line12 Get(string[] segments)
{
Line12 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line12))]
private partial class Line12SourceGenerationContext : JsonSerializerContext
{
}
private record Line13([property: JsonPropertyName("CassSlotSelected")] string CassetteSlotSelected)
{
internal static Line13 Get(string[] segments)
{
Line13 result;
ReadOnlyCollection<string> collection = Complete.GetCollection(segments);
result = new(collection.Count < 1 ? string.Empty : collection[0]);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Line13))]
private partial class Line13SourceGenerationContext : JsonSerializerContext
{
}
private record Point([property: JsonPropertyName("R")] string R,
[property: JsonPropertyName("Th")] string Th,
[property: JsonPropertyName("Data")] string Data,
[property: JsonPropertyName("Rs")] string Rs,
[property: JsonPropertyName("RsA")] string RsA,
[property: JsonPropertyName("RsB")] string RsB,
[property: JsonPropertyName("#Smpl")] string NumberSample,
[property: JsonPropertyName("x")] string X,
[property: JsonPropertyName("y")] string Y,
[property: JsonPropertyName("Irng")] string Irng,
[property: JsonPropertyName("Vrng")] string Vrng,
[property: JsonPropertyName("ChiSq")] string ChiSq,
[property: JsonPropertyName("merit/GOF")] string MeritGOF,
[property: JsonPropertyName("DataIntegrity")] string DataIntegrity)
{
internal static ReadOnlyCollection<Point> Get(int take, ReadOnlyCollection<string> lines, string[] separator)
{
List<Point> results = [];
Point point;
string[] segments;
ReadOnlyCollection<string> collection;
for (int i = take - 1; i < lines.Count; i++)
{
if (string.IsNullOrEmpty(lines[i]))
break;
segments = lines[i].Split(separator, StringSplitOptions.RemoveEmptyEntries);
collection = Complete.GetCollection(segments);
point = new(collection.Count < 1 ? string.Empty : collection[0],
collection.Count < 2 ? string.Empty : collection[1],
collection.Count < 3 ? string.Empty : collection[2],
collection.Count < 4 ? string.Empty : collection[3],
collection.Count < 5 ? string.Empty : collection[4],
collection.Count < 6 ? string.Empty : collection[5],
collection.Count < 7 ? string.Empty : collection[6],
collection.Count < 8 ? string.Empty : collection[7],
collection.Count < 9 ? string.Empty : collection[8],
collection.Count < 10 ? string.Empty : collection[9],
collection.Count < 11 ? string.Empty : collection[10],
collection.Count < 12 ? string.Empty : collection[11],
collection.Count < 13 ? string.Empty : collection[12],
collection.Count < 14 ? string.Empty : collection[13]);
results.Add(point);
}
return new(results);
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Point))]
private partial class PointSourceGenerationContext : JsonSerializerContext
{
}
internal static void GetComplete(ILogger<Worker> logger, List<string> args)
{
string searchPattern = args[2];
string sourceDirectory = Path.GetFullPath(args[0]);
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (files.Length != 1)
logger.LogError("No files found in {sourceDirectory} with search pattern {searchPattern}", sourceDirectory, searchPattern);
else
{
int take = 14;
string[] lines = File.ReadAllLines(files[0]);
if (lines.Length < take)
logger.LogError("File {files[0]} has less than {take} lines", files[0], take);
else
{
ReadOnlyCollection<string> collection = new(lines);
Complete? complete = Complete.Get(take, collection);
if (complete is null)
logger.LogError("Could not get Complete from {files[0]}", files[0]);
else
{
string json = JsonSerializer.Serialize(complete, CompleteSourceGenerationContext.Default.Complete);
File.WriteAllText($"{files[0]}.json", json);
}
}
}
}
#else
internal static void GetComplete(ILogger<Worker> logger, List<string> args)
{
logger.LogError("GetComplete is not available in CDE {args[0]}", args[0]);
logger.LogError("GetComplete is not available in CDE {args[1]}", args[1]);
}
#endif
}

View File

@ -79,8 +79,8 @@ internal static class HelperDay
ADO2024.PI2.Helper20240624.MoveUpOneDirectory(logger, args);
else if (args[1] == "Day-Helper-2024-07-11")
ADO2024.PI2.Helper20240711.GitRemoteRemove(logger, args);
// else if (args[1] == "Day-Helper-2024-07-18")
// ADO2024.PI2.Helper20240718.JsonToMarkdown(logger, args);
else if (args[1] == "Day-Helper-2024-07-18")
ADO2024.PI2.Helper20240718.JsonToMarkdown(logger, args);
else if (args[1] == "Day-Helper-2024-07-24")
ADO2024.PI2.Helper20240724.CopyDirectories(logger, args);
else if (args[1] == "Day-Helper-2024-07-28")
@ -89,20 +89,16 @@ internal static class HelperDay
ADO2024.PI3.Helper20240805.RenameFiles(logger, args);
else if (args[1] == "Day-Helper-2024-08-06")
ADO2024.PI3.Helper20240806.ArchiveFiles(logger, args);
#if WorkItems
else if (args[1] == "Day-Helper-2024-08-09")
ADO2024.PI3.Helper20240809.CreateWorkItems(logger, args);
#endif
else if (args[1] == "Day-Helper-2024-08-20")
ADO2024.PI3.Helper20240820.MoveFilesWithSleep(logger, args);
else if (args[1] == "Day-Helper-2024-08-22")
ADO2024.PI3.Helper20240822.ParseKanbn(logger, args);
else if (args[1] == "Day-Helper-2024-08-28")
ADO2024.PI3.Helper20240828.MoveWaferCounterToArchive(logger, args);
#if WorkItems
else if (args[1] == "Day-Helper-2024-08-30")
ADO2024.PI3.Helper20240830.CompareWorkItems(logger, args);
#endif
else if (args[1] == "Day-Helper-2024-09-10")
ADO2024.PI3.Helper20240910.MoveFilesToWeekOfYear(logger, args);
else if (args[1] == "Day-Helper-2024-09-11")
@ -113,6 +109,12 @@ internal static class HelperDay
ADO2024.PI3.Helper20240925.DistinctTests(logger, args);
else if (args[1] == "Day-Helper-2024-10-02")
ADO2024.PI3.Helper20241002.ConvertInfinityQSProjectFiles(logger, args);
else if (args[1] == "Day-Helper-2024-10-29")
ADO2024.PI3.Helper20241029.GetFibonacci(logger, args);
else if (args[1] == "Day-Helper-2024-10-30")
ADO2024.PI3.Helper20241030.GetComplete(logger, args);
else if (args[1] == "Day-Helper-2024-10-31")
ADO2024.PI3.Helper20241031.GetComplete(logger, args);
else
throw new Exception(appSettings.Company);
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>

View File

@ -159,12 +159,8 @@ internal static partial class HelperMarkdown
return results;
}
private static string[] GetFiles(AppSettings appSettings, string directory, SearchOption searchOption)
{
string[] results = Directory.GetFiles(directory, "*.md", searchOption).
Where(l => !appSettings.ExcludeDirectoryNames.Any(m => l.Contains(m))).ToArray();
return results;
}
private static FileInfo[] GetFiles(AppSettings appSettings, DirectoryInfo directoryInfo, SearchOption searchOption) =>
directoryInfo.GetFiles("*.md", searchOption).Where(l => !appSettings.ExcludeDirectoryNames.Any(m => l.FullName.Contains(m))).ToArray();
/// <summary>
/// Determines files text file's encoding by analyzing its byte order mark (BOM).
@ -293,16 +289,19 @@ internal static partial class HelperMarkdown
return results;
}
private static ReadOnlyCollection<string> GetFiles(AppSettings appSettings, Input input)
private static ReadOnlyCollection<FileInfo> GetFiles(AppSettings appSettings, Input input)
{
List<string> results = [];
List<string> files = [];
string[] directories = Directory.GetDirectories(input.Source, "*", SearchOption.AllDirectories);
foreach (string directory in directories)
List<FileInfo> results = [];
List<FileInfo> collection = [];
DirectoryInfo sourceDirectoryInfo = new(input.Source);
DirectoryInfo[] directories = sourceDirectoryInfo.GetDirectories("*", SearchOption.AllDirectories);
foreach (DirectoryInfo directoryInfo in directories)
{
files.Clear();
files.AddRange(GetFiles(appSettings, directory, SearchOption.TopDirectoryOnly));
foreach (string file in files)
collection.Clear();
if (!directoryInfo.Exists || (!string.IsNullOrEmpty(directoryInfo.LinkTarget) && !Directory.Exists(directoryInfo.LinkTarget)))
continue;
collection.AddRange(GetFiles(appSettings, directoryInfo, SearchOption.TopDirectoryOnly));
foreach (FileInfo file in collection)
results.Add(file);
}
return new(results);
@ -660,7 +659,6 @@ internal static partial class HelperMarkdown
string h1;
string key;
string type;
FileInfo fileInfo;
bool isKanbanIndex;
List<string> lines;
bool isWithinSource;
@ -670,15 +668,14 @@ internal static partial class HelperMarkdown
string fileNameWithoutExtension;
ReadOnlyDictionary<string, object> frontMatterYaml;
bool isGitOthersModifiedAndDeletedExcludingStandard;
ReadOnlyCollection<string> files = GetFiles(appSettings, input);
foreach (string file in files)
ReadOnlyCollection<FileInfo> files = GetFiles(appSettings, input);
foreach (FileInfo fileInfo in files)
{ // cSpell:disable
fileInfo = new(file);
if (fileInfo.DirectoryName is null)
continue;
key = Path.GetRelativePath(input.Source, file);
isWithinSource = file.Contains(input.Source);
isGitOthersModifiedAndDeletedExcludingStandard = gitOthersModifiedAndDeletedExcludingStandardFiles.Contains(file);
key = Path.GetRelativePath(input.Source, fileInfo.FullName);
isWithinSource = fileInfo.FullName.Contains(input.Source);
isGitOthersModifiedAndDeletedExcludingStandard = gitOthersModifiedAndDeletedExcludingStandardFiles.Contains(fileInfo.FullName);
if (!isWithinSource && results.ContainsKey(key))
continue;
(lines, lineNumber) = GetStatusAndFrontMatterYamlEndLineNumbers(fileInfo);
@ -692,15 +689,15 @@ internal static partial class HelperMarkdown
if (!isGitOthersModifiedAndDeletedExcludingStandard)
continue;
type = appSettings.DefaultNoteType;
File.WriteAllLines(file, ["---", $"type: {type}\"", "---", string.Empty, $"# {h1}"]);
lines = File.ReadAllLines(file).ToList();
File.WriteAllLines(fileInfo.FullName, ["---", $"type: {type}\"", "---", string.Empty, $"# {h1}"]);
lines = File.ReadAllLines(fileInfo.FullName).ToList();
}
isKanbanMarkdown = fileInfo.Name.EndsWith(".knb.md");
isKanbanIndex = fileNameWithoutExtension == "index" && type.StartsWith("kanb", StringComparison.OrdinalIgnoreCase);
markdownFile = new(fileInfo.CreationTime,
fileInfo.DirectoryName,
fileInfo.Extension,
file,
fileInfo.FullName,
fileInfo.Name,
fileNameWithoutExtension,
frontMatterYaml,