From 547c044dc6c54090bc3531d6926e05ed2ca3f27d Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 16 Aug 2020 01:19:23 -0400 Subject: [PATCH] Fix namespace for StringConverter --- .../Datastore/Converters/StringConverter.cs | 31 ++++++++++--------- .../Migration/166_fix_tmdb_list_config.cs | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/NzbDrone.Core/Datastore/Converters/StringConverter.cs b/src/NzbDrone.Core/Datastore/Converters/StringConverter.cs index f0315f832..71b082bd9 100644 --- a/src/NzbDrone.Core/Datastore/Converters/StringConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/StringConverter.cs @@ -2,25 +2,28 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; -public class StringConverter : JsonConverter +namespace NzbDrone.Core.Datastore.Converters { - public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public class StringConverter : JsonConverter { - if (reader.TokenType == JsonTokenType.Number) + public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var stringValue = reader.GetInt32(); - return stringValue.ToString(); + if (reader.TokenType == JsonTokenType.Number) + { + var stringValue = reader.GetInt32(); + return stringValue.ToString(); + } + else if (reader.TokenType == JsonTokenType.String) + { + return reader.GetString(); + } + + throw new System.Text.Json.JsonException(); } - else if (reader.TokenType == JsonTokenType.String) + + public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options) { - return reader.GetString(); + writer.WriteStringValue(value); } - - throw new System.Text.Json.JsonException(); - } - - public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options) - { - writer.WriteStringValue(value); } } diff --git a/src/NzbDrone.Core/Datastore/Migration/166_fix_tmdb_list_config.cs b/src/NzbDrone.Core/Datastore/Migration/166_fix_tmdb_list_config.cs index ffe3b2e50..82446970c 100644 --- a/src/NzbDrone.Core/Datastore/Migration/166_fix_tmdb_list_config.cs +++ b/src/NzbDrone.Core/Datastore/Migration/166_fix_tmdb_list_config.cs @@ -5,6 +5,7 @@ using System.Text.Json; using Dapper; using FluentMigrator; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Datastore.Converters; using NzbDrone.Core.Datastore.Migration.Framework; namespace NzbDrone.Core.Datastore.Migration