-Added dotnet build
-Removed WinRT files -Updated solution files to VS2015 -Updated psake
This commit is contained in:
@@ -37,9 +37,8 @@ using System.Reflection;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Utilities
|
||||
@@ -152,14 +151,15 @@ namespace Newtonsoft.Json.Utilities
|
||||
{ typeof(Uri), PrimitiveTypeCode.Uri },
|
||||
{ typeof(string), PrimitiveTypeCode.String },
|
||||
{ typeof(byte[]), PrimitiveTypeCode.Bytes },
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
|
||||
#if !(PORTABLE || PORTABLE40 || DOTNET)
|
||||
{ typeof(DBNull), PrimitiveTypeCode.DBNull }
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !PORTABLE
|
||||
private static readonly TypeInformation[] PrimitiveTypeCodes =
|
||||
{
|
||||
// need all of these. lookup against the index with TypeCode value
|
||||
new TypeInformation { Type = typeof(object), TypeCode = PrimitiveTypeCode.Empty },
|
||||
new TypeInformation { Type = typeof(object), TypeCode = PrimitiveTypeCode.Object },
|
||||
new TypeInformation { Type = typeof(object), TypeCode = PrimitiveTypeCode.DBNull },
|
||||
@@ -219,7 +219,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return PrimitiveTypeCode.Object;
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !PORTABLE
|
||||
public static TypeInformation GetTypeInformation(IConvertible convertable)
|
||||
{
|
||||
TypeInformation typeInformation = PrimitiveTypeCodes[(int)convertable.GetTypeCode()];
|
||||
@@ -229,12 +229,12 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsConvertible(Type t)
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !PORTABLE
|
||||
return typeof(IConvertible).IsAssignableFrom(t);
|
||||
#else
|
||||
return (
|
||||
t == typeof(bool) || t == typeof(byte) || t == typeof(char) || t == typeof(DateTime) || t == typeof(decimal) || t == typeof(double) || t == typeof(short) || t == typeof(int) ||
|
||||
t == typeof(long) || t == typeof(sbyte) || t == typeof(float) || t == typeof(string) || t == typeof(ushort) || t == typeof(uint) || t == typeof(ulong) || t.IsEnum());
|
||||
return (
|
||||
t == typeof(bool) || t == typeof(byte) || t == typeof(char) || t == typeof(DateTime) || t == typeof(decimal) || t == typeof(double) || t == typeof(short) || t == typeof(int) ||
|
||||
t == typeof(long) || t == typeof(sbyte) || t == typeof(float) || t == typeof(string) || t == typeof(ushort) || t == typeof(uint) || t == typeof(ulong) || t.IsEnum());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#region TryConvert
|
||||
#region TryConvert
|
||||
internal enum ConvertResult
|
||||
{
|
||||
Success = 0,
|
||||
@@ -496,7 +496,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
// see if source or target types have a TypeConverter that converts between the two
|
||||
TypeConverter toConverter = GetConverter(initialType);
|
||||
|
||||
@@ -514,7 +514,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.Success;
|
||||
}
|
||||
#endif
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
// handle DBNull and INullable
|
||||
if (initialValue == DBNull.Value)
|
||||
{
|
||||
@@ -529,7 +529,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.CannotConvertNull;
|
||||
}
|
||||
#endif
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
if (initialValue is INullable)
|
||||
{
|
||||
value = EnsureTypeAssignable(ToValue((INullable)initialValue), initialType, targetType);
|
||||
@@ -546,9 +546,9 @@ namespace Newtonsoft.Json.Utilities
|
||||
value = null;
|
||||
return ConvertResult.NoValidConversion;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ConvertOrCast
|
||||
#region ConvertOrCast
|
||||
/// <summary>
|
||||
/// Converts the value to the specified type. If the value is unable to be converted, the
|
||||
/// value is checked whether it assignable to the specified type.
|
||||
@@ -575,7 +575,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
return EnsureTypeAssignable(initialValue, ReflectionUtils.GetObjectType(initialValue), targetType);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private static object EnsureTypeAssignable(object value, Type initialType, Type targetType)
|
||||
{
|
||||
@@ -599,7 +599,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
throw new ArgumentException("Could not cast or convert from {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, (initialType != null) ? initialType.ToString() : "{null}", targetType));
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
public static object ToValue(INullable nullableValue)
|
||||
{
|
||||
if (nullableValue == null)
|
||||
@@ -619,7 +619,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
internal static TypeConverter GetConverter(Type t)
|
||||
{
|
||||
return JsonTypeReflector.GetTypeConverter(t);
|
||||
|
||||
Reference in New Issue
Block a user