[v1.7.0] Add support for IC880A Board

This commit is contained in:
BlubbFish 2019-01-29 17:09:45 +00:00
parent 55e7622418
commit f9c1b53ef6
2 changed files with 38 additions and 38 deletions

View File

@ -1,22 +1,22 @@
#region Header
/**
* JsonMapper.cs
* JSON to .Net object and object to JSON conversions.
*
* The authors disclaim copyright to this source code. For more details, see
* the COPYING file included with this distribution.
**/
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
#region Header
/**
* JsonMapper.cs
* JSON to .Net object and object to JSON conversions.
*
* The authors disclaim copyright to this source code. For more details, see
* the COPYING file included with this distribution.
**/
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
namespace LitJson {
internal struct PropertyMetadata {
public MemberInfo Info;
@ -74,7 +74,7 @@ namespace LitJson {
public delegate IJsonWrapper WrapperFactory();
public class JsonMapper {
#region Fields
#region Fields
private static readonly Int32 max_nesting_depth;
private static readonly IFormatProvider datetime_format;
@ -101,7 +101,7 @@ namespace LitJson {
private static readonly Object static_writer_lock = new Object();
#endregion
#region Constructors
#region Constructors
static JsonMapper() {
max_nesting_depth = 100;
@ -123,9 +123,9 @@ namespace LitJson {
RegisterBaseExporters();
RegisterBaseImporters();
}
#endregion
#endregion
#region Private Methods
#region Private Methods
private static void AddArrayMetadata(Type type) {
if (array_metadata.ContainsKey(type)) {
return;
@ -291,15 +291,15 @@ namespace LitJson {
Type value_type = underlying_type ?? inst_type;
if (reader.Token == JsonToken.Null) {
#if NETSTANDARD1_5
if (inst_type.IsClass() || underlying_type != null) {
return null;
}
#else
#if NETSTANDARD1_5
if (inst_type.IsClass() || underlying_type != null) {
return null;
}
#else
if (inst_type.IsClass || underlying_type != null) {
return null;
}
#endif
#endif
throw new JsonException(String.Format("Can't assign null to an instance of type {0}", inst_type));
}
@ -339,14 +339,14 @@ namespace LitJson {
}
// Maybe it's an enum
#if NETSTANDARD1_5
if (value_type.IsEnum())
return Enum.ToObject (value_type, reader.Value);
#else
#if NETSTANDARD1_5
if (value_type.IsEnum())
return Enum.ToObject (value_type, reader.Value);
#else
if (value_type.IsEnum) {
return Enum.ToObject(value_type, reader.Value);
}
#endif
#endif
// Try using an implicit conversion operator
MethodInfo conv_op = GetConvOp(value_type, json_type);
@ -529,7 +529,7 @@ namespace LitJson {
base_exporters_table[typeof(DateTime)] = delegate (Object obj, JsonWriter writer) {
writer.Write(Convert.ToString((DateTime)obj, datetime_format));
};
};
base_exporters_table[typeof(TimeSpan)] = delegate (Object obj, JsonWriter writer) {
writer.Write(Convert.ToString((TimeSpan)obj, datetime_format));
};
@ -767,7 +767,7 @@ namespace LitJson {
}
writer.WriteObjectEnd();
}
#endregion
#endregion
public static String ToJson(Object obj) {
@ -853,5 +853,5 @@ namespace LitJson {
public static void UnregisterImporters() {
custom_importers_table.Clear();
}
}
}
}
}