94 lines
2.9 KiB
C#
94 lines
2.9 KiB
C#
using log4net;
|
|
using System;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace Adaptation.FileHandlers.Stratus;
|
|
|
|
#nullable enable
|
|
|
|
public class Footer
|
|
{
|
|
|
|
public Footer(string meanThickness, string stdDev)
|
|
{
|
|
MeanThickness = meanThickness;
|
|
StdDev = stdDev;
|
|
}
|
|
|
|
public string MeanThickness { get; }
|
|
public string StdDev { get; }
|
|
|
|
private static string GetBefore(string text, int[] i, string search, bool trim)
|
|
{
|
|
string str;
|
|
string before;
|
|
if (trim)
|
|
before = Header.GetBefore(text, i, search);
|
|
else
|
|
{
|
|
int num = text.IndexOf(search, i[0]);
|
|
if (num <= -1)
|
|
{
|
|
str = text.Substring(i[0]);
|
|
i[0] = text.Length;
|
|
before = str;
|
|
}
|
|
else
|
|
{
|
|
str = text.Substring(i[0], num - i[0]);
|
|
i[0] = num + search.Length;
|
|
before = str;
|
|
}
|
|
}
|
|
return before;
|
|
}
|
|
|
|
private static string GetToEOL(string text, int[] i, bool trim)
|
|
{
|
|
string str;
|
|
if (text.IndexOf("\n", i[0]) > -1)
|
|
str = !trim ? GetBefore(text, i, "\n", false) : Header.GetToEOL(text, i);
|
|
else
|
|
str = !trim ? GetBefore(text, i, Environment.NewLine, false) : Header.GetToEOL(text, i);
|
|
return str;
|
|
}
|
|
|
|
private static bool IsBlankLine(string text, int[] i)
|
|
{
|
|
int num = text.IndexOf("\n", i[0]);
|
|
return Wafer.IsNullOrWhiteSpace(num > -1 ? text.Substring(i[0], num - i[0]) : text.Substring(i[0]));
|
|
}
|
|
|
|
internal static Footer? Get(Constant constant, ReadOnlyCollection<string> groups)
|
|
{
|
|
Footer? result;
|
|
int[] j = new int[] { 0 };
|
|
string stdDev = string.Empty;
|
|
string meanThickness = string.Empty;
|
|
foreach (string groupText in groups)
|
|
{
|
|
if (groupText.Contains(constant.Destination))
|
|
continue;
|
|
stdDev = string.Empty;
|
|
meanThickness = string.Empty;
|
|
Header.ScanPast(groupText, j, constant.Mean);
|
|
meanThickness = Wafer.GetToken(groupText, j);
|
|
if (meanThickness.EndsWith(","))
|
|
meanThickness = meanThickness.Remove(meanThickness.Length - 1, 1);
|
|
Header.ScanPast(groupText, j, constant.STDD);
|
|
stdDev = Wafer.GetToken(groupText, j);
|
|
if (stdDev.EndsWith(","))
|
|
stdDev = stdDev.Remove(stdDev.Length - 1, 1);
|
|
}
|
|
// if (PeekNextLine(groupText, j).Contains(constant.Cassette))
|
|
// _ = Header.GetToEOL(groupText, j);
|
|
// if (PeekNextLine(groupText, j).Contains(constant.Cassette))
|
|
// _ = Header.GetToEOL(groupText, j);
|
|
// if (PeekNextLine(groupText, j).Contains("Process failed"))
|
|
// _ = Header.GetToEOL(groupText, j);
|
|
result = new(meanThickness: meanThickness,
|
|
stdDev: stdDev);
|
|
return result;
|
|
}
|
|
|
|
} |