Use typed item mass and thermal facts
This commit is contained in:
parent
0568ea71db
commit
a8f6df5bb1
160 changed files with 344 additions and 275 deletions
|
|
@ -387,6 +387,7 @@ internal static class LegacyCatalogReader
|
|||
LegacyId = legacyId,
|
||||
Description = description,
|
||||
Mass = GetDouble(payload, 4),
|
||||
SpecificHeat = GetPositiveDoubleOrDefault(payload, 6, 1),
|
||||
Volume = shape.OccupiedCells,
|
||||
ManufacturerLegacyId = GetOptionalGuid(payload, 3),
|
||||
Price = GetInt(payload, 8),
|
||||
|
|
@ -588,6 +589,12 @@ internal static class LegacyCatalogReader
|
|||
};
|
||||
}
|
||||
|
||||
private static double GetPositiveDoubleOrDefault(IReadOnlyDictionary<int, object?> payload, int key, double fallback)
|
||||
{
|
||||
var value = GetDouble(payload, key);
|
||||
return value > 0 ? value : fallback;
|
||||
}
|
||||
|
||||
private static int GetInt(IReadOnlyDictionary<int, object?> payload, int key)
|
||||
{
|
||||
if (!payload.TryGetValue(key, out var value) || value == null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue