Change from ticks to IQS ID and SC

Change pool to Windows-Service
Build Tests first
Disable Tests
This commit is contained in:
2023-03-09 11:26:07 -07:00
parent 8040a7c6b5
commit 994556d453
2 changed files with 104 additions and 18 deletions

View File

@ -67,24 +67,35 @@ public class ExportRepository : IExportRepository
List<HeaderCommon> results = new();
string json;
HeaderCommon? hc;
string ticks = "Ticks";
string? directory;
string directoryName;
JsonElement? jsonElement;
const string ticks = "Ticks";
JsonProperty[] jsonProperties;
List<string> files = GetFiles(headerCommon, "*.json");
foreach (string file in files)
{
json = File.ReadAllText(file);
jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
if (jsonElement is null || jsonElement.Value.ValueKind != JsonValueKind.Object)
continue;
jsonProperties = (from l in jsonElement.Value.EnumerateObject() where l.Name == ticks select l).ToArray();
if (!jsonProperties.Any() || !long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
continue;
hc = JsonSerializer.Deserialize<HeaderCommon>(json);
if (hc is null)
continue;
hc.ID = ticksValue;
hc.Date = new(ticksValue);
if (hc.ID < 1)
{
directory = Path.GetDirectoryName(file);
if (directory is null)
continue;
directoryName = Path.GetFileName(directory);
if (directoryName.Length < 1 || directoryName[0] != '-' || !long.TryParse(directoryName[1..], out long id))
continue;
hc.ID = id;
}
jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
if (jsonElement is not null && jsonElement.Value.ValueKind == JsonValueKind.Object)
{
jsonProperties = (from l in jsonElement.Value.EnumerateObject() where l.Name == ticks select l).ToArray();
if (jsonProperties.Any() && long.TryParse(jsonProperties[0].Value.ToString(), out long ticksValue))
hc.Date = new(ticksValue);
}
results.Add(hc);
}
result = new()