-Added netstandard1.1 with BigInteger support
This commit is contained in:
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -232,7 +232,7 @@ namespace Newtonsoft.Json.Bson
|
||||
/// <param name="value">The <see cref="Object"/> value to write.</param>
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
InternalWriteValue(JsonToken.Integer);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#endregion
|
||||
|
||||
#if !PORTABLE40
|
||||
#if !(PORTABLE || NET20 || NET35)
|
||||
#if !(PORTABLE || NET20 || NET35) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System;
|
||||
@@ -1635,7 +1635,7 @@ namespace Newtonsoft.Json.Converters
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.Integer)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
if (reader.Value is BigInteger)
|
||||
{
|
||||
return ((BigInteger)reader.Value).ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
@@ -238,7 +238,7 @@ namespace Newtonsoft.Json
|
||||
return value.ToString(null, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
private static string ToStringInternal(BigInteger value)
|
||||
{
|
||||
return value.ToString(null, CultureInfo.InvariantCulture);
|
||||
@@ -510,7 +510,7 @@ namespace Newtonsoft.Json
|
||||
return ToString((Uri)value);
|
||||
case PrimitiveTypeCode.TimeSpan:
|
||||
return ToString((TimeSpan)value);
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
return ToStringInternal((BigInteger)value);
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -623,7 +623,7 @@ namespace Newtonsoft.Json
|
||||
if (!(Value is double))
|
||||
{
|
||||
double d;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
d = (double)(BigInteger)Value;
|
||||
@@ -683,7 +683,7 @@ namespace Newtonsoft.Json
|
||||
case JsonToken.Integer:
|
||||
case JsonToken.Float:
|
||||
bool b;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
b = (BigInteger)Value != 0;
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -747,7 +747,7 @@ namespace Newtonsoft.Json
|
||||
case '9':
|
||||
ParseNumber(ReadType.Read);
|
||||
bool b;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (Value is BigInteger)
|
||||
{
|
||||
b = (BigInteger)Value != 0;
|
||||
@@ -2022,7 +2022,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
else if (parseResult == ParseResult.Overflow)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
string number = _stringReference.ToString();
|
||||
|
||||
if (number.Length > MaximumJavascriptIntegerCharacterLength)
|
||||
@@ -2076,7 +2076,7 @@ namespace Newtonsoft.Json
|
||||
SetToken(numberType, numberValue, false);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
// By using the BigInteger type in a separate method,
|
||||
// the runtime can execute the ParseNumber even if
|
||||
// the System.Numerics.BigInteger.Parse method is
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -359,7 +359,7 @@ namespace Newtonsoft.Json
|
||||
/// <param name="value">The <see cref="Object"/> value to write.</param>
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
InternalWriteValue(JsonToken.Integer);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -840,7 +840,7 @@ namespace Newtonsoft.Json
|
||||
if (schema.DivisibleBy != null)
|
||||
{
|
||||
bool notDivisible;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
// not that this will lose any decimal point on DivisibleBy
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -532,7 +532,7 @@ namespace Newtonsoft.Json
|
||||
break;
|
||||
case JsonToken.Integer:
|
||||
ValidationUtils.ArgumentNotNull(value, nameof(value));
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
WriteValue((BigInteger)value);
|
||||
@@ -1392,7 +1392,7 @@ namespace Newtonsoft.Json
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
// this is here because adding a WriteValue(BigInteger) to JsonWriter will
|
||||
// mean the user has to add a reference to System.Numerics.dll
|
||||
if (value is BigInteger)
|
||||
@@ -1550,7 +1550,7 @@ namespace Newtonsoft.Json
|
||||
case PrimitiveTypeCode.TimeSpanNullable:
|
||||
writer.WriteValue((value == null) ? (TimeSpan?)null : (TimeSpan)value);
|
||||
break;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
// this will call to WriteValue(object)
|
||||
writer.WriteValue((BigInteger)value);
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
private static readonly JTokenType[] BooleanTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean };
|
||||
private static readonly JTokenType[] NumberTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean };
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
private static readonly JTokenType[] BigIntegerTypes = new[] { JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean, JTokenType.Bytes };
|
||||
#endif
|
||||
private static readonly JTokenType[] StringTypes = new[] { JTokenType.Date, JTokenType.Integer, JTokenType.Float, JTokenType.String, JTokenType.Comment, JTokenType.Raw, JTokenType.Boolean, JTokenType.Bytes, JTokenType.Guid, JTokenType.TimeSpan, JTokenType.Uri };
|
||||
@@ -492,7 +492,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
||||
@@ -546,7 +546,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Boolean.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return Convert.ToBoolean((int)(BigInteger)v.Value);
|
||||
@@ -569,7 +569,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (long)(BigInteger)v.Value;
|
||||
@@ -660,7 +660,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (decimal?)(BigInteger)v.Value;
|
||||
@@ -688,7 +688,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (double?)(BigInteger)v.Value;
|
||||
@@ -716,7 +716,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (char?)(BigInteger)v.Value;
|
||||
@@ -739,7 +739,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (int)(BigInteger)v.Value;
|
||||
@@ -762,7 +762,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (short)(BigInteger)v.Value;
|
||||
@@ -786,7 +786,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ushort)(BigInteger)v.Value;
|
||||
@@ -810,7 +810,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Char.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (char)(BigInteger)v.Value;
|
||||
@@ -833,7 +833,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (byte)(BigInteger)v.Value;
|
||||
@@ -857,7 +857,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to SByte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (sbyte)(BigInteger)v.Value;
|
||||
@@ -885,7 +885,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (int?)(BigInteger)v.Value;
|
||||
@@ -913,7 +913,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (short?)(BigInteger)v.Value;
|
||||
@@ -942,7 +942,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt16.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ushort?)(BigInteger)v.Value;
|
||||
@@ -970,7 +970,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Byte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (byte?)(BigInteger)v.Value;
|
||||
@@ -999,7 +999,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to SByte.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (sbyte?)(BigInteger)v.Value;
|
||||
@@ -1050,7 +1050,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Int64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (long?)(BigInteger)v.Value;
|
||||
@@ -1078,7 +1078,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (float?)(BigInteger)v.Value;
|
||||
@@ -1101,7 +1101,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Decimal.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (decimal)(BigInteger)v.Value;
|
||||
@@ -1130,7 +1130,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (uint?)(BigInteger)v.Value;
|
||||
@@ -1159,7 +1159,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ulong?)(BigInteger)v.Value;
|
||||
@@ -1182,7 +1182,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Double.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (double)(BigInteger)v.Value;
|
||||
@@ -1205,7 +1205,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to Single.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (float)(BigInteger)v.Value;
|
||||
@@ -1241,7 +1241,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return Convert.ToBase64String((byte[])v.Value);
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return ((BigInteger)v.Value).ToString(CultureInfo.InvariantCulture);
|
||||
@@ -1265,7 +1265,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt32.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (uint)(BigInteger)v.Value;
|
||||
@@ -1289,7 +1289,7 @@ namespace Newtonsoft.Json.Linq
|
||||
throw new ArgumentException("Can not convert {0} to UInt64.".FormatWith(CultureInfo.InvariantCulture, GetType(value)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return (ulong)(BigInteger)v.Value;
|
||||
@@ -1321,7 +1321,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return Convert.FromBase64String(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (v.Value is BigInteger)
|
||||
{
|
||||
return ((BigInteger)v.Value).ToByteArray();
|
||||
@@ -1456,7 +1456,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return (v.Value is Uri) ? (Uri)v.Value : new Uri(Convert.ToString(v.Value, CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
private static BigInteger ToBigInteger(JToken value)
|
||||
{
|
||||
JValue v = EnsureValue(value);
|
||||
@@ -2035,7 +2035,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return (TimeSpan?)this;
|
||||
case PrimitiveTypeCode.TimeSpan:
|
||||
return (TimeSpan)this;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
case PrimitiveTypeCode.BigIntegerNullable:
|
||||
return ToBigIntegerNullable(this);
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -221,7 +221,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// <param name="value">The <see cref="Object"/> value to write.</param>
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
InternalWriteValue(JsonToken.Integer);
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.Globalization;
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
|
||||
#endif
|
||||
@@ -219,7 +219,7 @@ namespace Newtonsoft.Json.Linq
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
private static int CompareBigInteger(BigInteger i1, object i2)
|
||||
{
|
||||
int result = i1.CompareTo(ConvertUtils.ToBigInteger(i2));
|
||||
@@ -264,7 +264,7 @@ namespace Newtonsoft.Json.Linq
|
||||
switch (valueType)
|
||||
{
|
||||
case JTokenType.Integer:
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (objA is BigInteger)
|
||||
{
|
||||
return CompareBigInteger((BigInteger)objA, objB);
|
||||
@@ -287,7 +287,7 @@ namespace Newtonsoft.Json.Linq
|
||||
return Convert.ToInt64(objA, CultureInfo.InvariantCulture).CompareTo(Convert.ToInt64(objB, CultureInfo.InvariantCulture));
|
||||
}
|
||||
case JTokenType.Float:
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (objA is BigInteger)
|
||||
{
|
||||
return CompareBigInteger((BigInteger)objA, objB);
|
||||
@@ -428,7 +428,7 @@ namespace Newtonsoft.Json.Linq
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (objA is BigInteger || objB is BigInteger)
|
||||
{
|
||||
if (objA == null || objB == null)
|
||||
@@ -632,7 +632,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
return JTokenType.Integer;
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
else if (value is BigInteger)
|
||||
{
|
||||
return JTokenType.Integer;
|
||||
@@ -768,7 +768,7 @@ namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
writer.WriteValue((ulong)_value);
|
||||
}
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
else if (_value is BigInteger)
|
||||
{
|
||||
writer.WriteValue((BigInteger)_value);
|
||||
|
||||
@@ -32,8 +32,10 @@ using System.Security;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
#if NETSTANDARD10
|
||||
#if NETSTANDARD1_0
|
||||
[assembly: AssemblyTitle("Json.NET .NET Standard 1.0")]
|
||||
#elif NETSTANDARD1_1
|
||||
[assembly: AssemblyTitle("Json.NET .NET Standard 1.1")]
|
||||
#elif PORTABLE40
|
||||
[assembly: AssemblyTitle("Json.NET Portable .NET 4.0")]
|
||||
#elif PORTABLE
|
||||
|
||||
@@ -487,7 +487,7 @@ namespace Newtonsoft.Json.Schema
|
||||
case PrimitiveTypeCode.UInt32:
|
||||
case PrimitiveTypeCode.Int64:
|
||||
case PrimitiveTypeCode.UInt64:
|
||||
#if !(PORTABLE || NET35 || NET20)
|
||||
#if !(PORTABLE || NET35 || NET20) || NETSTANDARD1_1
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
#endif
|
||||
return schemaType | JsonSchemaType.Integer;
|
||||
|
||||
@@ -33,7 +33,7 @@ using System.Dynamic;
|
||||
#endif
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
@@ -966,7 +966,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
return ConvertUtils.FromBigInteger((BigInteger)value, contract.NonNullableUnderlyingType);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -139,7 +139,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
public override void WriteValue(object value)
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
if (value is BigInteger)
|
||||
{
|
||||
_textWriter.WriteValue(value);
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -145,7 +145,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{ typeof(Guid?), PrimitiveTypeCode.GuidNullable },
|
||||
{ typeof(TimeSpan), PrimitiveTypeCode.TimeSpan },
|
||||
{ typeof(TimeSpan?), PrimitiveTypeCode.TimeSpanNullable },
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
{ typeof(BigInteger), PrimitiveTypeCode.BigInteger },
|
||||
{ typeof(BigInteger?), PrimitiveTypeCode.BigIntegerNullable },
|
||||
#endif
|
||||
@@ -311,7 +311,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return o => call(null, o);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
internal static BigInteger ToBigInteger(object value)
|
||||
{
|
||||
if (value is BigInteger)
|
||||
@@ -540,7 +540,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
if (targetType == typeof(BigInteger))
|
||||
{
|
||||
value = ToBigInteger(initialValue);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
@@ -1105,7 +1105,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return 0m;
|
||||
case PrimitiveTypeCode.DateTime:
|
||||
return new DateTime();
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
return new BigInteger();
|
||||
#endif
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
"netstandard1.0": {
|
||||
"buildOptions": {
|
||||
"define": [
|
||||
"NETSTANDARD10",
|
||||
"NETSTANDARD1_0",
|
||||
"PORTABLE"
|
||||
]
|
||||
},
|
||||
@@ -129,6 +129,39 @@
|
||||
"System.Xml.ReaderWriter": "4.0.11",
|
||||
"System.Xml.XDocument": "4.0.11"
|
||||
}
|
||||
},
|
||||
"netstandard1.1": {
|
||||
"buildOptions": {
|
||||
"define": [
|
||||
"NETSTANDARD1_1",
|
||||
"PORTABLE"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": "4.0.1",
|
||||
"System.Collections": "4.0.11",
|
||||
"System.Diagnostics.Debug": "4.0.11",
|
||||
"System.Dynamic.Runtime": "4.0.11",
|
||||
"System.Globalization": "4.0.11",
|
||||
"System.IO": "4.1.0",
|
||||
"System.Linq": "4.1.0",
|
||||
"System.Linq.Expressions": "4.1.0",
|
||||
"System.ObjectModel": "4.0.12",
|
||||
"System.Reflection": "4.1.0",
|
||||
"System.Reflection.Extensions": "4.0.1",
|
||||
"System.Resources.ResourceManager": "4.0.1",
|
||||
"System.Runtime": "4.1.0",
|
||||
"System.Runtime.Extensions": "4.1.0",
|
||||
"System.Runtime.Numerics": "4.0.1",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"System.Text.Encoding": "4.0.11",
|
||||
"System.Text.Encoding.Extensions": "4.0.11",
|
||||
"System.Text.RegularExpressions": "4.1.0",
|
||||
"System.Threading": "4.0.11",
|
||||
"System.Threading.Tasks": "4.0.11",
|
||||
"System.Xml.ReaderWriter": "4.0.11",
|
||||
"System.Xml.XDocument": "4.0.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user