Mike Phares 61188f434d UniqueId replacement for attachments
Write input PDSF in output after EOF

GetPropertyValue for MoveMatchingFiles

ProcessDataStandardFormat over Tuple

MoveMatchingFiles to use ProcessDataStandardFormatMapping
2025-04-23 13:45:07 -07:00

234 lines
8.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Adaptation.FileHandlers.Stratus;
#nullable enable
public class Wafer
{
public Wafer(string destination, string mean, string passFail, string recipe, string reference, ReadOnlyCollection<string> sites, string slot, string source, string stdDev, string waferText)
{
Destination = destination;
Mean = mean;
PassFail = passFail;
Recipe = recipe;
Reference = reference;
Sites = sites;
Slot = slot;
Source = source;
StdDev = stdDev;
Text = waferText;
}
public string Destination { get; }
public string Mean { get; }
public string PassFail { get; }
public string Recipe { get; }
public string Reference { get; }
public ReadOnlyCollection<string> Sites { get; }
public string Slot { get; }
public string Source { get; }
public string StdDev { get; }
public string Text { get; }
internal static string GetToken(string text, int[] i)
{
while (true)
{
if (i[0] >= text.Length || !IsNullOrWhiteSpace(text.Substring(i[0], 1)))
break;
i[0]++;
}
int num = i[0];
while (true)
{
if (num >= text.Length || IsNullOrWhiteSpace(text.Substring(num, 1)))
break;
num++;
}
string str = text.Substring(i[0], num - i[0]);
i[0] = num;
return str.Trim();
}
internal static bool IsNullOrWhiteSpace(string search)
{
bool flag;
int num = 0;
while (true)
{
if (num >= search.Length)
{
flag = true;
break;
}
else if (char.IsWhiteSpace(search[num]))
num++;
else
{
flag = false;
break;
}
}
return flag;
}
internal static string PeekNextLine(string text, int[] i)
{
int num = i[0];
string toEOL = Header.GetToEOL(text, i);
i[0] = num;
return toEOL;
}
internal static ReadOnlyCollection<string> GetGroups(string text, Constant constant, int[] i)
{
List<string> results = new();
string[] lines = text.Substring(i[0]).Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
if (lines.Length > 0)
{
List<string> group = new();
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line.Trim()))
continue;
group.Add(line);
if (line.StartsWith(constant.Destination)
|| line.Contains(constant.ProcessFailed)
|| line.StartsWith(constant.WaferParentheses) && line.Contains(constant.IsPut))
{
results.Add(string.Join(Environment.NewLine, group));
group.Clear();
}
}
results.Add(string.Join(Environment.NewLine, group));
}
return results.AsReadOnly();
}
internal static ReadOnlyCollection<Wafer> Get(Constant constant, ReadOnlyCollection<string> groups)
{
List<Wafer> results = new();
string mean;
string slot;
Wafer wafer;
string recipe;
string source;
string stdDev;
string nextLine;
string passFail;
string reference;
string thickness;
string waferText;
string destination;
List<string> sites;
int[] j = new int[] { 0 };
foreach (string groupText in groups)
{
j[0] = 0;
sites = new();
if (groupText.Contains(constant.ProcessFailed))
{
mean = string.Empty;
slot = string.Empty;
recipe = string.Empty;
source = string.Empty;
stdDev = string.Empty;
passFail = string.Empty;
reference = string.Empty;
waferText = string.Empty;
destination = string.Empty;
}
else if (groupText.Contains(constant.Reference))
{
mean = string.Empty;
slot = string.Empty;
recipe = string.Empty;
stdDev = string.Empty;
passFail = string.Empty;
waferText = string.Empty;
Header.ScanPast(groupText, j, constant.Reference);
reference = Header.GetToEOL(groupText, j);
Header.ScanPast(groupText, j, constant.Source);
source = Header.GetToEOL(groupText, j).Trim();
Header.ScanPast(groupText, j, constant.Destination);
destination = Header.GetToEOL(groupText, j).Trim();
}
else
{
if (!groupText.Contains(constant.Wafer))
continue;
Header.ScanPast(groupText, j, constant.Wafer);
waferText = Header.GetToEOL(groupText, j);
if (waferText.EndsWith("."))
waferText = waferText.Remove(waferText.Length - 1, 1);
Header.ScanPast(groupText, j, constant.Slot);
slot = Header.GetToEOL(groupText, j);
Header.ScanPast(groupText, j, constant.Recipe);
recipe = Header.GetToEOL(groupText, j);
if (recipe.EndsWith("."))
recipe = recipe.Remove(recipe.Length - 1, 1);
Header.ScanPast(groupText, j, constant.Thickness);
_ = GetToken(groupText, j);
nextLine = PeekNextLine(groupText, j);
if (nextLine.Contains(constant.OneHypen))
{
Header.ScanPast(groupText, j, constant.OneHypen);
_ = GetToken(groupText, j);
}
for (int k = 0; k < 100; k++)
{
nextLine = PeekNextLine(groupText, j);
if (nextLine.Contains("Slot"))
break;
if (string.IsNullOrEmpty(nextLine))
{
_ = Header.GetToEOL(groupText, j);
continue;
}
thickness = GetToken(groupText, j);
if (thickness == constant.Thickness)
{
_ = GetToken(groupText, j);
continue;
}
sites.Add(thickness);
}
Header.ScanPast(groupText, j, constant.Slot);
_ = GetToken(groupText, j);
passFail = GetToken(groupText, j);
if (passFail.EndsWith("."))
passFail = passFail.Remove(passFail.Length - 1, 1);
Header.ScanPast(groupText, j, constant.Mean);
mean = GetToken(groupText, j);
if (mean.EndsWith(","))
mean = mean.Remove(mean.Length - 1, 1);
Header.ScanPast(groupText, j, constant.STDD);
stdDev = Header.GetToEOL(groupText, j);
if (stdDev.EndsWith("."))
stdDev = stdDev.Remove(stdDev.Length - 1, 1);
reference = string.Empty;
Header.ScanPast(groupText, j, constant.Source);
source = Header.GetToEOL(groupText, j).Trim();
Header.ScanPast(groupText, j, constant.Destination);
destination = Header.GetToEOL(groupText, j).Trim();
}
wafer = new(destination: destination,
mean: mean,
passFail: passFail,
recipe: recipe,
reference: reference,
sites: sites.AsReadOnly(),
slot: slot,
source: source,
stdDev: stdDev,
waferText: waferText);
results.Add(wafer);
}
return results.AsReadOnly();
}
}