From 18a9821247923a26755cc8d71452515a3a20b32a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Wed, 29 Jan 2020 22:14:09 +0100 Subject: [PATCH] Add workaround for https://github.com/JustArchiNET/ASF-ui/issues/871 --- ArchiSteamFarm/IPC/Startup.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ArchiSteamFarm/IPC/Startup.cs b/ArchiSteamFarm/IPC/Startup.cs index c9287236c07da..4c6800afe557d 100644 --- a/ArchiSteamFarm/IPC/Startup.cs +++ b/ArchiSteamFarm/IPC/Startup.cs @@ -35,7 +35,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.OpenApi.Models; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; namespace ArchiSteamFarm.IPC { @@ -220,9 +219,8 @@ public void ConfigureServices(IServiceCollection services) { mvc.AddApiExplorer(); #endif - // Add JSON formatters that will be used as default ones if no specific formatters are asked for - // Fix default contract resolver to use original names and not a camel case and add debugging aid while we're at it #if NETFRAMEWORK + // Add JSON formatters that will be used as default ones if no specific formatters are asked for mvc.AddJsonFormatters(); mvc.AddJsonOptions( @@ -230,8 +228,11 @@ public void ConfigureServices(IServiceCollection services) { mvc.AddNewtonsoftJson( #endif options => { + // Fix default contract resolver to use original names and not a camel case options.SerializerSettings.ContractResolver = new DefaultContractResolver(); - options.SerializerSettings.Converters.Add(new StringEnumConverter()); + + // TODO: Enable this again once ASF-ui adds support in https://github.com/JustArchiNET/ASF-ui/issues/871 + //options.SerializerSettings.Converters.Add(new StringEnumConverter()); if (Debugging.IsUserDebugging) { options.SerializerSettings.Formatting = Formatting.Indented;