Complete Class
This commit is contained in:
@ -530,6 +530,27 @@ public class ProcessData : IProcessData
|
||||
}
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
|
||||
private Complete? GetComplete(string altHeaderFileName)
|
||||
{
|
||||
Complete? result;
|
||||
const int take = 12;
|
||||
const string site = "Site: ";
|
||||
const string multiple = "MULTIPLE";
|
||||
const string summaryLine = "SUMMARY A A";
|
||||
const string lastUnits = "Flat Z: Grade : % Flat Z: Grade : % Flat Z: Grade : %";
|
||||
string[] lines = File.ReadAllLines(altHeaderFileName);
|
||||
if (lines.Length > take)
|
||||
result = Complete.Get(take, site, multiple, summaryLine, lastUnits, lines);
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
_Log.Warn($"File {altHeaderFileName} has less than 5 lines");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060
|
||||
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, string ghostPCLFileName, string pdfTextStripperFileName)
|
||||
#pragma warning restore IDE0060
|
||||
@ -673,10 +694,25 @@ public class ProcessData : IProcessData
|
||||
detail.UniqueId = string.Concat(detail, detail.UniqueId);
|
||||
}
|
||||
fileInfoCollection.Add(logistics.FileInfo);
|
||||
try
|
||||
{
|
||||
Complete? complete = GetComplete(altHeaderFileName);
|
||||
if (complete is null)
|
||||
_Log.Warn($"Could not get Complete from {altHeaderFileName}");
|
||||
else
|
||||
{
|
||||
FileInfo fileInfo = new($"{altHeaderFileName}.json");
|
||||
string json = JsonSerializer.Serialize(complete, CompleteSourceGenerationContext.Default.Complete);
|
||||
File.WriteAllText(fileInfo.FullName, json);
|
||||
fileInfoCollection.Add(fileInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_Log.Error($"Error in {nameof(GetComplete)}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
|
||||
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
|
||||
{
|
||||
List<Description> results = new();
|
||||
|
Reference in New Issue
Block a user