MET08THFTIRQS408M - v2.43.0 - Using EDA

Multiple Storage Paths and delete old way
This commit is contained in:
2022-06-07 11:13:11 -07:00
parent ad688483ed
commit 72a9f902bc
72 changed files with 3713 additions and 2018 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.QS408M;
@ -144,9 +145,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;
}
@ -183,7 +184,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)
@ -302,7 +303,7 @@ public partial class ProcessData : IProcessData
int counter = 1;
while (true)
{
if ((string.IsNullOrEmpty(token) || !char.IsDigit(token[0])))
if (string.IsNullOrEmpty(token) || !char.IsDigit(token[0]))
break;
Detail detail = new()
{
@ -408,7 +409,7 @@ public partial class ProcessData : IProcessData
}
//trace datatype
_Log.Debug("BioRad parsed infomation:");
_Log.Debug("BioRad parsed information:");
_Log.Debug(string.Format("Batch: {0}", Batch));
_Log.Debug(string.Format("Cassette: {0}", Cassette));
_Log.Debug(string.Format("Date: {0}", Date));
@ -426,4 +427,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;
}
}