From d5942cd67014ff5bb7e878b2f3e85f70fd945e7f Mon Sep 17 00:00:00 2001 From: Alex Shibalkin Date: Thu, 16 Jan 2025 17:32:03 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=80=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DD.Persistence.Client/Clients/SetpointClient.cs | 8 +++++--- DD.Persistence.Client/DD.Persistence.Client.csproj | 10 +++++----- DD.Persistence.Models/DD.Persistence.Models.csproj | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/DD.Persistence.Client/Clients/SetpointClient.cs b/DD.Persistence.Client/Clients/SetpointClient.cs index b9c472a..5f0a838 100644 --- a/DD.Persistence.Client/Clients/SetpointClient.cs +++ b/DD.Persistence.Client/Clients/SetpointClient.cs @@ -4,6 +4,7 @@ using DD.Persistence.Client.Clients.Interfaces; using DD.Persistence.Client.Clients.Interfaces.Refit; using DD.Persistence.Models; using System.Text.Json; +using System.Text.Json.Serialization; namespace DD.Persistence.Client.Clients; @@ -11,7 +12,7 @@ public class SetpointClient : BaseClient, ISetpointClient { private readonly IRefitSetpointClient refitSetpointClient; - public SetpointClient(IRefitClientFactory refitSetpointClientFactory, ILogger logger) : base(logger) + public SetpointClient(IRefitClientFactory refitSetpointClientFactory, ILogger logger) : base(logger) { this.refitSetpointClient = refitSetpointClientFactory.Create(); } @@ -32,19 +33,20 @@ public class SetpointClient : BaseClient, ISetpointClient return dict; } + private static Dictionary DeserializeResultToDict(Dictionary setpointConfigs, IEnumerable data) { var dict = new Dictionary(); + foreach (var valueDto in data) { - if (valueDto.Value is not null && valueDto.Value is JsonElement element && setpointConfigs.TryGetValue(valueDto.Key, out var type) && type is not null) - dict[valueDto.Key] = element.Deserialize(type!) ?? valueDto.Value; + dict[valueDto.Key] = Convert.ChangeType(element.GetString(), type) ?? valueDto.Value; else dict[valueDto.Key] = valueDto.Value; } diff --git a/DD.Persistence.Client/DD.Persistence.Client.csproj b/DD.Persistence.Client/DD.Persistence.Client.csproj index 12bdea4..e56c2f8 100644 --- a/DD.Persistence.Client/DD.Persistence.Client.csproj +++ b/DD.Persistence.Client/DD.Persistence.Client.csproj @@ -11,9 +11,9 @@ DD.Persistence.Client - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)).1 - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)).1 DD.Persistence.Client @@ -33,15 +33,15 @@ snupkg - C:\Projects\Nuget\Persistence\Client + C:\Projects\Nuget\Persistence Readme.md - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) diff --git a/DD.Persistence.Models/DD.Persistence.Models.csproj b/DD.Persistence.Models/DD.Persistence.Models.csproj index dc4772e..7506594 100644 --- a/DD.Persistence.Models/DD.Persistence.Models.csproj +++ b/DD.Persistence.Models/DD.Persistence.Models.csproj @@ -11,9 +11,9 @@ DD.Persistence.Models - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) DD.Persistence.Models @@ -33,7 +33,7 @@ snupkg - C:\Projects\Nuget\Persistence\Models + C:\Projects\Nuget\Persistence