From 8a779af880b96754a4d9d0322e399e8c3caafc4b Mon Sep 17 00:00:00 2001 From: oneRain Date: Wed, 13 May 2020 14:13:08 +0800 Subject: [PATCH] * LCJsonConverter.cs: * Common-Unity.csproj: chore --- Common/Common-Unity/Common-Unity.csproj | 3 ++ .../Storage/Internal/Http/LCJsonConverter.cs | 35 ------------------- 2 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 Storage/Storage/Internal/Http/LCJsonConverter.cs diff --git a/Common/Common-Unity/Common-Unity.csproj b/Common/Common-Unity/Common-Unity.csproj index 63689bf..c8928d6 100644 --- a/Common/Common-Unity/Common-Unity.csproj +++ b/Common/Common-Unity/Common-Unity.csproj @@ -27,6 +27,9 @@ Task\LCTaskExtensions.cs + + Json\LCJsonConverter.cs + diff --git a/Storage/Storage/Internal/Http/LCJsonConverter.cs b/Storage/Storage/Internal/Http/LCJsonConverter.cs deleted file mode 100644 index d79bd9d..0000000 --- a/Storage/Storage/Internal/Http/LCJsonConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using Newtonsoft.Json; - -namespace LeanCloud.Storage.Internal { - public class LCJsonConverter : JsonConverter { - public override bool CanConvert(Type objectType) { - return objectType == typeof(object); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { - serializer.Serialize(writer, value); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - if (reader.TokenType == JsonToken.StartObject) { - var obj = new Dictionary(); - serializer.Populate(reader, obj); - return obj; - } - if (reader.TokenType == JsonToken.StartArray) { - var arr = new List(); - serializer.Populate(reader, arr); - return arr; - } - if (reader.TokenType == JsonToken.Integer) { - if ((long)reader.Value < int.MaxValue) { - return Convert.ToInt32(reader.Value); - } - } - - return serializer.Deserialize(reader); - } - } -}