You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Framework.LayerStyleConvert.XSDClass
|
|
|
|
|
{
|
|
|
|
|
// Token: 0x02000032 RID: 50
|
|
|
|
|
public class FieldCreationConverter : CustomCreationConverter<Field>
|
|
|
|
|
{
|
|
|
|
|
// Token: 0x06000158 RID: 344 RVA: 0x000041F0 File Offset: 0x000023F0
|
|
|
|
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
|
|
|
|
{
|
|
|
|
|
object result;
|
|
|
|
|
if (objectType.IsAbstract && objectType.Equals(typeof(Field)))
|
|
|
|
|
{
|
|
|
|
|
JObject jobject = JObject.Load(reader);
|
|
|
|
|
JProperty jproperty = null;
|
|
|
|
|
foreach (JProperty jproperty2 in jobject.Properties())
|
|
|
|
|
{
|
|
|
|
|
if (jproperty2.Name.ToLower() == "length")
|
|
|
|
|
{
|
|
|
|
|
jproperty = jproperty2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (jproperty != null)
|
|
|
|
|
{
|
|
|
|
|
result = (Field)jobject.ToObject(typeof(FieldWithLength), serializer);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = (Field)jobject.ToObject(typeof(FieldNomal), serializer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (reader.TokenType == JsonToken.Null)
|
|
|
|
|
{
|
|
|
|
|
result = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Field field = this.Create(objectType);
|
|
|
|
|
if (field == null)
|
|
|
|
|
{
|
|
|
|
|
throw new JsonSerializationException("No object created.");
|
|
|
|
|
}
|
|
|
|
|
serializer.Populate(reader, field);
|
|
|
|
|
result = field;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Token: 0x06000159 RID: 345 RVA: 0x0000432C File Offset: 0x0000252C
|
|
|
|
|
public override Field Create(Type objectType)
|
|
|
|
|
{
|
|
|
|
|
object obj = Activator.CreateInstance(objectType);
|
|
|
|
|
return (Field)obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|