MET08THFTIRSTRATUS - v2.43.0 - Using EDA

Multiple Storage Paths and delete old way
This commit is contained in:
2022-06-07 11:17:12 -07:00
parent 75974ae87d
commit ffce7ecf75
74 changed files with 3987 additions and 2117 deletions

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
namespace Adaptation.FileHandlers.Stratus;
@ -136,9 +137,9 @@ public partial class ProcessData : IProcessData
{
string str;
if (_Data.IndexOf("\n", _I) > -1)
str = (!trim ? GetBefore("\n", false) : GetToEOL());
str = !trim ? GetBefore("\n", false) : GetToEOL();
else
str = (!trim ? GetBefore(Environment.NewLine, false) : GetToEOL());
str = !trim ? GetBefore(Environment.NewLine, false) : GetToEOL();
return str;
}
@ -146,7 +147,7 @@ public partial class ProcessData : IProcessData
{
while (true)
{
if ((_I >= _Data.Length || !IsNullOrWhiteSpace(_Data.Substring(_I, 1))))
if (_I >= _Data.Length || !IsNullOrWhiteSpace(_Data.Substring(_I, 1)))
{
break;
}
@ -175,7 +176,7 @@ public partial class ProcessData : IProcessData
private bool IsBlankLine()
{
int num = _Data.IndexOf("\n", _I);
return IsNullOrWhiteSpace((num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)));
return IsNullOrWhiteSpace(num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I));
}
private static bool IsNullOrWhiteSpace(string text)
@ -295,7 +296,7 @@ public partial class ProcessData : IProcessData
Cassette = Regex.Replace(Cassette, @"[\\,\/,\:,\*,\?,\"",\<,\>,\|]", "_").Split('\r')[0].Split('\n')[0];
if (Cassette.StartsWith("1T") || Cassette.StartsWith("1t"))
Cassette = Cassette.Substring(2);
Title = (!string.IsNullOrEmpty(Batch) ? Batch : Cassette);
Title = !string.IsNullOrEmpty(Batch) ? Batch : Cassette;
ScanPast(startedAt);
string dateTimeText = GetToEOL();
if (dateTimeText.EndsWith("."))
@ -460,4 +461,19 @@ public partial class ProcessData : IProcessData
_Details.AddRange(details);
}
internal static List<Description> GetDescriptions(JsonElement[] jsonElements)
{
List<Description> results = new();
Description description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
results.Add(description);
}
return results;
}
}