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