Change from ticks to IQS ID and SC
Change pool to Windows-Service Build Tests first Disable Tests
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user