axsharp icon indicating copy to clipboard operation
axsharp copied to clipboard

[bs-operon] string reformating when datetime related type

Open kuh0005 opened this issue 7 months ago • 1 comments

https://github.com/user-attachments/assets/c278294f-0fee-4075-ba79-706957043f80

kuh0005 avatar Jun 12 '25 11:06 kuh0005

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);

kuh0005 avatar Jun 16 '25 12:06 kuh0005