axsharp
axsharp copied to clipboard
[bs-operon] string reformating when datetime related type
https://github.com/user-attachments/assets/c278294f-0fee-4075-ba79-706957043f80
The first level of the problem is reading a variable through a WebAPI request. The response is classified as a DateTime. I suppose this changes when reading. The problem is that you're passing a number that gets rounded, so casting it from DateTime is not an accurate solution.
@PTKu, what’s your opinion?
var position = 0;
foreach (var p in apiPrimitives)
{
var indexResult = responseData.SuccessfulResponses.ElementAt(position++);
switch (p)
{
case OnlinerString s:
if (indexResult.Result is string)
{
p.Read(indexResult.Result.ToString());
}
else
{
var rpc = indexResult.ToString();
RpcResponse response = JsonSerializer.Deserialize<RpcResponse>(rpc);
p.Read(response.Result);
}
break;
default:
p.Read(indexResult.Result.ToString());
break;
}
p.AccessStatus.Update(RwCycleCount);