Enhance PCL and PDSF file handlers with new constants and refactor methods for improved readability and functionality
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Adaptation.FileHandlers.pcl;
|
||||
@ -215,17 +216,35 @@ public class Header
|
||||
return GetBefore(text, i, "\n", false);
|
||||
}
|
||||
|
||||
internal static Header Get(ReadOnlyDictionary<string, string> pages, Constant constant, string headerFileName)
|
||||
private static string? GetText(ReadOnlyDictionary<string, string> pages, Constant constant)
|
||||
{
|
||||
string? text;
|
||||
string? headerFileName = null;
|
||||
foreach (KeyValuePair<string, string> keyValuePair in pages)
|
||||
{
|
||||
if (!pages.TryGetValue(keyValuePair.Key, out text))
|
||||
throw new Exception();
|
||||
if (!text.Contains(constant.Statistics))
|
||||
continue;
|
||||
headerFileName = keyValuePair.Key;
|
||||
}
|
||||
headerFileName ??= pages.Count == 0 ? string.Empty : pages.ElementAt(pages.Count - 1).Key;
|
||||
if (pages.Count == 0 || !pages.TryGetValue(headerFileName, out text))
|
||||
text = null;
|
||||
return text;
|
||||
}
|
||||
|
||||
internal static Header Get(ReadOnlyDictionary<string, string> pages, Constant constant)
|
||||
{
|
||||
Header? result;
|
||||
string id;
|
||||
string? text;
|
||||
string[] segmentsB;
|
||||
string[] segmentsC;
|
||||
int[] i = new int[] { 0 };
|
||||
WaferSummary waferSummary;
|
||||
List<WaferSummary> collection = new();
|
||||
if (!pages.TryGetValue(headerFileName, out text))
|
||||
string? text = GetText(pages, constant);
|
||||
if (string.IsNullOrEmpty(text))
|
||||
throw new Exception();
|
||||
ScanPast(text, i, constant.Date);
|
||||
string date = GetToEOL(text, i);
|
||||
|
||||
Reference in New Issue
Block a user