-Added dotnet build

-Removed WinRT files
-Updated solution files to VS2015
-Updated psake
This commit is contained in:
James Newton-King
2015-08-02 23:56:26 +12:00
parent 7bad8a73c4
commit fe7b7a6c7b
102 changed files with 507 additions and 1247 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Bson
public void Close()
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
_writer.Close();
#else
_writer.Dispose();
+1 -1
View File
@@ -297,7 +297,7 @@ namespace Newtonsoft.Json.Bson
base.Close();
if (CloseInput && _reader != null)
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
_reader.Close();
#else
_reader.Dispose();
+1 -1
View File
@@ -379,7 +379,7 @@ namespace Newtonsoft.Json.Bson
{
base.WriteValue(value);
string s = null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
s = value.ToString(CultureInfo.InvariantCulture);
#else
s = value.ToString();
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Data.SqlTypes;
using System.Globalization;
@@ -24,6 +24,7 @@
#endregion
using System;
using System.Reflection;
using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json.Converters
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Data;
using Newtonsoft.Json.Serialization;
@@ -23,10 +23,10 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Utilities;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
using System;
using System.Data;
using Newtonsoft.Json.Serialization;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Converters
/// </summary>
public class DiscriminatedUnionConverter : JsonConverter
{
#region UnionDefinition
#region UnionDefinition
internal class Union
{
public List<UnionCase> Cases;
@@ -60,7 +60,7 @@ namespace Newtonsoft.Json.Converters
public FSharpFunction FieldReader;
public FSharpFunction Constructor;
}
#endregion
#endregion
private const string CasePropertyName = "Case";
private const string FieldsPropertyName = "Fields";
@@ -235,7 +235,7 @@ namespace Newtonsoft.Json.Converters
// all fsharp objects have CompilationMappingAttribute
// get the fsharp assembly from the attribute and initialize latebound methods
object[] attributes;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
attributes = objectType.GetCustomAttributes(true);
#else
attributes = objectType.GetTypeInfo().GetCustomAttributes(true).ToArray();
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || DOTNET || PORTABLE40 || PORTABLE)
using System;
using Newtonsoft.Json.Serialization;
using System.Globalization;
@@ -31,6 +31,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Xml;
using System.Reflection;
#if !(NET20 || PORTABLE40)
using System.Xml.Linq;
#endif
@@ -44,7 +45,7 @@ using System.Linq;
namespace Newtonsoft.Json.Converters
{
#region XmlNodeWrappers
#if !NETFX_CORE && !PORTABLE && !PORTABLE40
#if !DOTNET && !PORTABLE && !PORTABLE40
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
{
private readonly XmlDocument _document;
@@ -928,7 +929,7 @@ namespace Newtonsoft.Json.Converters
if (value is XObject)
return XContainerWrapper.WrapNode((XObject)value);
#endif
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
if (value is XmlNode)
return XmlNodeWrapper.WrapNode((XmlNode)value);
#endif
@@ -1256,7 +1257,7 @@ namespace Newtonsoft.Json.Converters
rootNode = document;
}
#endif
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
if (typeof(XmlNode).IsAssignableFrom(objectType))
{
if (objectType != typeof(XmlDocument))
@@ -1448,7 +1449,7 @@ namespace Newtonsoft.Json.Converters
#endif
DateTime d = Convert.ToDateTime(reader.Value, CultureInfo.InvariantCulture);
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
return XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind));
#else
return XmlConvert.ToString(d);
@@ -1780,7 +1781,7 @@ namespace Newtonsoft.Json.Converters
if (typeof(XObject).IsAssignableFrom(valueType))
return true;
#endif
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
if (typeof(XmlNode).IsAssignableFrom(valueType))
return true;
#endif
@@ -1,5 +1,5 @@

#if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE
#if DOTNET || PORTABLE40 || PORTABLE
namespace System.Runtime.Serialization.Formatters
{
+3 -3
View File
@@ -357,7 +357,7 @@ namespace Newtonsoft.Json
{
string text;
string qc;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
text = value.ToString("D", CultureInfo.InvariantCulture);
qc = quoteChar.ToString(CultureInfo.InvariantCulture);
#else
@@ -481,7 +481,7 @@ namespace Newtonsoft.Json
return ToString((DateTime)value);
case PrimitiveTypeCode.Decimal:
return ToString((decimal)value);
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
case PrimitiveTypeCode.DBNull:
return Null;
#endif
@@ -969,7 +969,7 @@ namespace Newtonsoft.Json
}
#endif
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
/// <summary>
/// Serializes the XML node to a JSON string.
/// </summary>
+2 -2
View File
@@ -35,7 +35,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs during JSON serialization or deserialization.
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
public class JsonException : Exception
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonException"/> class.
/// </summary>
+2 -2
View File
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs while reading JSON text.
/// </summary>
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
[Serializable]
#endif
public class JsonReaderException : JsonException
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonReaderException"/> class.
/// </summary>
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs during JSON serialization or deserialization.
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
public class JsonSerializationException : JsonException
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonSerializationException"/> class.
/// </summary>
+3 -1
View File
@@ -1624,11 +1624,13 @@ namespace Newtonsoft.Json
base.Close();
if (CloseInput && _reader != null)
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
{
#if !(DOTNET || PORTABLE40 || PORTABLE)
_reader.Close();
#else
_reader.Dispose();
#endif
}
if (_buffer != null)
_buffer.Clear();
+4 -2
View File
@@ -152,11 +152,13 @@ namespace Newtonsoft.Json
base.Close();
if (CloseOutput && _writer != null)
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
{
#if !(DOTNET || PORTABLE40 || PORTABLE)
_writer.Close();
#else
_writer.Dispose();
#endif
}
}
/// <summary>
@@ -636,7 +638,7 @@ namespace Newtonsoft.Json
string text = null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
text = value.ToString("D", CultureInfo.InvariantCulture);
#else
text = value.ToString("D");
+2 -2
View File
@@ -1396,13 +1396,13 @@ namespace Newtonsoft.Json
case PrimitiveTypeCode.Bytes:
writer.WriteValue((byte[])value);
break;
#if !(PORTABLE || NETFX_CORE)
#if !(PORTABLE || DOTNET)
case PrimitiveTypeCode.DBNull:
writer.WriteNull();
break;
#endif
default:
#if !(PORTABLE || NETFX_CORE)
#if !PORTABLE
if (value is IConvertible)
{
// the value is a non-standard IConvertible
+2 -2
View File
@@ -33,7 +33,7 @@ namespace Newtonsoft.Json
/// <summary>
/// The exception thrown when an error occurs while reading JSON text.
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
public class JsonWriterException : JsonException
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonWriterException"/> class.
/// </summary>
+10 -12
View File
@@ -46,17 +46,15 @@ namespace Newtonsoft.Json.Linq
/// Represents a token that can contain other tokens.
/// </summary>
public abstract class JContainer : JToken, IList<JToken>
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
, ITypedList, IBindingList
#elif PORTABLE
, INotifyCollectionChanged
#endif
, IList
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35 || PORTABLE40)
, INotifyCollectionChanged
#endif
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
internal ListChangedEventHandler _listChanged;
internal AddingNewEventHandler _addingNew;
@@ -132,7 +130,7 @@ namespace Newtonsoft.Json.Linq
return new List<JToken>();
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Raises the <see cref="AddingNew"/> event.
/// </summary>
@@ -376,7 +374,7 @@ namespace Newtonsoft.Json.Linq
ChildrenTokens.Insert(index, item);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
#endif
@@ -410,7 +408,7 @@ namespace Newtonsoft.Json.Linq
ChildrenTokens.RemoveAt(index);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
#endif
@@ -474,7 +472,7 @@ namespace Newtonsoft.Json.Linq
existing.Previous = null;
existing.Next = null;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
#endif
@@ -497,7 +495,7 @@ namespace Newtonsoft.Json.Linq
ChildrenTokens.Clear();
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
#endif
@@ -791,7 +789,7 @@ namespace Newtonsoft.Json.Linq
return hashCode;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
{
return string.Empty;
@@ -960,7 +958,7 @@ namespace Newtonsoft.Json.Linq
#endregion
#region IBindingList Members
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
void IBindingList.AddIndex(PropertyDescriptor property)
{
}
+8 -8
View File
@@ -52,10 +52,10 @@ namespace Newtonsoft.Json.Linq
/// <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="LinqToJsonCreateParse" title="Parsing a JSON Object from Text" />
/// </example>
public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
, ICustomTypeDescriptor
#endif
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || PORTABLE40 || PORTABLE)
, INotifyPropertyChanging
#endif
{
@@ -75,7 +75,7 @@ namespace Newtonsoft.Json.Linq
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NET20 || PORTABLE || PORTABLE40)
/// <summary>
/// Occurs when a property value is changing.
/// </summary>
@@ -192,7 +192,7 @@ namespace Newtonsoft.Json.Linq
internal void InternalPropertyChanged(JProperty childProperty)
{
OnPropertyChanged(childProperty.Name);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (_listChanged != null)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty)));
#endif
@@ -204,7 +204,7 @@ namespace Newtonsoft.Json.Linq
internal void InternalPropertyChanging(JProperty childProperty)
{
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || PORTABLE40 || PORTABLE)
OnPropertyChanging(childProperty.Name);
#endif
}
@@ -307,7 +307,7 @@ namespace Newtonsoft.Json.Linq
}
else
{
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || PORTABLE40 || PORTABLE)
OnPropertyChanging(propertyName);
#endif
Add(new JProperty(propertyName, value));
@@ -618,7 +618,7 @@ namespace Newtonsoft.Json.Linq
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE || NET20)
#if !(PORTABLE40 || PORTABLE || NET20)
/// <summary>
/// Raises the <see cref="PropertyChanging"/> event with the provided arguments.
/// </summary>
@@ -630,7 +630,7 @@ namespace Newtonsoft.Json.Linq
}
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// include custom type descriptor on JObject rather than use a provider because the properties are specific to a type
#region ICustomTypeDescriptor
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System;
using System.ComponentModel;
+2 -2
View File
@@ -52,7 +52,7 @@ namespace Newtonsoft.Json.Linq
/// Represents an abstract JSON token.
/// </summary>
public abstract class JToken : IJEnumerable<JToken>, IJsonLineInfo
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
, ICloneable
#endif
#if !(NET35 || NET20 || PORTABLE40)
@@ -2069,7 +2069,7 @@ namespace Newtonsoft.Json.Linq
}
#endif
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
object ICloneable.Clone()
{
return DeepClone();
+1 -1
View File
@@ -365,7 +365,7 @@ namespace Newtonsoft.Json.Linq
{
base.WriteValue(value);
string s = null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
s = value.ToString(CultureInfo.InvariantCulture);
#else
s = value.ToString();
+10 -5
View File
@@ -42,7 +42,7 @@ namespace Newtonsoft.Json.Linq
/// Represents a value in JSON (string, integer, date, etc).
/// </summary>
public class JValue : JToken, IEquatable<JValue>, IFormattable, IComparable, IComparable<JValue>
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
, IConvertible
#endif
{
@@ -563,7 +563,7 @@ namespace Newtonsoft.Json.Linq
{
if (value == null)
return JTokenType.Null;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
else if (value == DBNull.Value)
return JTokenType.Null;
#endif
@@ -965,7 +965,7 @@ namespace Newtonsoft.Json.Linq
return Compare(_valueType, _value, obj._value);
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
TypeCode IConvertible.GetTypeCode()
{
if (_value == null)
@@ -980,7 +980,12 @@ namespace Newtonsoft.Json.Linq
return TypeCode.Object;
#endif
return System.Type.GetTypeCode(_value.GetType());
IConvertible convertable = _value as IConvertible;
if (convertable == null)
return TypeCode.Object;
return convertable.GetTypeCode();
}
bool IConvertible.ToBoolean(IFormatProvider provider)
@@ -1058,5 +1063,5 @@ namespace Newtonsoft.Json.Linq
return ToObject(conversionType);
}
#endif
}
}
}
@@ -1,320 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{263136A2-B89B-424E-A87A-F988CAA8D032}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json</RootNamespace>
<AssemblyName>Newtonsoft.Json</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
<CodeAnalysisRuleSet>Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\WinRT\Newtonsoft.Json.xml</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="Bson\BsonBinaryType.cs" />
<Compile Include="Bson\BsonBinaryWriter.cs" />
<Compile Include="Bson\BsonObjectId.cs" />
<Compile Include="Bson\BsonReader.cs" />
<Compile Include="Bson\BsonToken.cs" />
<Compile Include="Bson\BsonType.cs" />
<Compile Include="Bson\BsonWriter.cs" />
<Compile Include="ConstructorHandling.cs" />
<Compile Include="Converters\BinaryConverter.cs" />
<Compile Include="Converters\BsonObjectIdConverter.cs" />
<Compile Include="Converters\CustomCreationConverter.cs" />
<Compile Include="Converters\DataSetConverter.cs" />
<Compile Include="Converters\DataTableConverter.cs" />
<Compile Include="Converters\DateTimeConverterBase.cs" />
<Compile Include="Converters\DiscriminatedUnionConverter.cs" />
<Compile Include="Converters\EntityKeyMemberConverter.cs" />
<Compile Include="Converters\ExpandoObjectConverter.cs" />
<Compile Include="Converters\IsoDateTimeConverter.cs" />
<Compile Include="Converters\JavaScriptDateTimeConverter.cs" />
<Compile Include="Converters\JsonValueConverter.cs" />
<Compile Include="Converters\KeyValuePairConverter.cs" />
<Compile Include="Converters\RegexConverter.cs" />
<Compile Include="Converters\StringEnumConverter.cs" />
<Compile Include="Converters\VersionConverter.cs" />
<Compile Include="Converters\XmlNodeConverter.cs" />
<Compile Include="DateFormatHandling.cs" />
<Compile Include="DateParseHandling.cs" />
<Compile Include="DateTimeZoneHandling.cs" />
<Compile Include="FloatFormatHandling.cs" />
<Compile Include="DefaultValueHandling.cs" />
<Compile Include="FloatParseHandling.cs" />
<Compile Include="FormatterAssemblyStyle.cs" />
<Compile Include="Formatting.cs" />
<Compile Include="IJsonLineInfo.cs" />
<Compile Include="JsonArrayAttribute.cs" />
<Compile Include="JsonConstructorAttribute.cs" />
<Compile Include="JsonContainerAttribute.cs" />
<Compile Include="JsonConvert.cs" />
<Compile Include="JsonConverter.cs" />
<Compile Include="JsonConverterAttribute.cs" />
<Compile Include="JsonConverterCollection.cs" />
<Compile Include="JsonDictionaryAttribute.cs" />
<Compile Include="JsonException.cs" />
<Compile Include="JsonExtensionDataAttribute.cs" />
<Compile Include="JsonIgnoreAttribute.cs" />
<Compile Include="JsonObjectAttribute.cs" />
<Compile Include="JsonPosition.cs" />
<Compile Include="JsonPropertyAttribute.cs" />
<Compile Include="JsonReader.cs" />
<Compile Include="JsonReaderException.cs" />
<Compile Include="JsonSerializationException.cs" />
<Compile Include="JsonSerializer.cs" />
<Compile Include="JsonSerializerSettings.cs" />
<Compile Include="JsonTextReader.cs" />
<Compile Include="JsonTextWriter.cs" />
<Compile Include="JsonToken.cs" />
<Compile Include="JsonValidatingReader.cs" />
<Compile Include="JsonWriter.cs" />
<Compile Include="JsonWriterException.cs" />
<Compile Include="Linq\Extensions.cs" />
<Compile Include="Linq\IJEnumerable.cs" />
<Compile Include="Linq\JArray.cs" />
<Compile Include="Linq\JConstructor.cs" />
<Compile Include="Linq\JContainer.cs" />
<Compile Include="Linq\JEnumerable.cs" />
<Compile Include="Linq\JObject.cs" />
<Compile Include="Linq\JProperty.cs" />
<Compile Include="Linq\JPropertyDescriptor.cs" />
<Compile Include="Linq\JPropertyKeyedCollection.cs" />
<Compile Include="Linq\JRaw.cs" />
<Compile Include="Linq\JsonMergeSettings.cs" />
<Compile Include="Linq\JsonPath\ArrayIndexFilter.cs" />
<Compile Include="Linq\JsonPath\ArrayMultipleIndexFilter.cs" />
<Compile Include="Linq\JsonPath\ArraySliceFilter.cs" />
<Compile Include="Linq\JsonPath\FieldFilter.cs" />
<Compile Include="Linq\JsonPath\FieldMultipleFilter.cs" />
<Compile Include="Linq\JsonPath\JPath.cs" />
<Compile Include="Linq\JsonPath\PathFilter.cs" />
<Compile Include="Linq\JsonPath\QueryExpression.cs" />
<Compile Include="Linq\JsonPath\QueryFilter.cs" />
<Compile Include="Linq\JsonPath\ScanFilter.cs" />
<Compile Include="Linq\JToken.cs" />
<Compile Include="Linq\JTokenEqualityComparer.cs" />
<Compile Include="Linq\JTokenReader.cs" />
<Compile Include="Linq\JTokenType.cs" />
<Compile Include="Linq\JTokenWriter.cs" />
<Compile Include="Linq\JValue.cs" />
<Compile Include="Linq\MergeArrayHandling.cs" />
<Compile Include="MemberSerialization.cs" />
<Compile Include="MissingMemberHandling.cs" />
<Compile Include="NullValueHandling.cs" />
<Compile Include="ObjectCreationHandling.cs" />
<Compile Include="PreserveReferencesHandling.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReferenceLoopHandling.cs" />
<Compile Include="Required.cs" />
<Compile Include="Schema\Extensions.cs" />
<Compile Include="Schema\JsonSchema.cs" />
<Compile Include="Schema\JsonSchemaBuilder.cs" />
<Compile Include="Schema\JsonSchemaConstants.cs" />
<Compile Include="Schema\JsonSchemaException.cs" />
<Compile Include="Schema\JsonSchemaGenerator.cs" />
<Compile Include="Schema\JsonSchemaModel.cs" />
<Compile Include="Schema\JsonSchemaModelBuilder.cs" />
<Compile Include="Schema\JsonSchemaNode.cs" />
<Compile Include="Schema\JsonSchemaNodeCollection.cs" />
<Compile Include="Schema\JsonSchemaResolver.cs" />
<Compile Include="Schema\JsonSchemaType.cs" />
<Compile Include="Schema\JsonSchemaWriter.cs" />
<Compile Include="Schema\UndefinedSchemaIdHandling.cs" />
<Compile Include="Schema\ValidationEventArgs.cs" />
<Compile Include="Schema\ValidationEventHandler.cs" />
<Compile Include="SerializationBinder.cs" />
<Compile Include="Serialization\CachedAttributeGetter.cs" />
<Compile Include="Serialization\CamelCasePropertyNamesContractResolver.cs" />
<Compile Include="Serialization\DefaultContractResolver.cs" />
<Compile Include="Serialization\DefaultReferenceResolver.cs" />
<Compile Include="Serialization\DefaultSerializationBinder.cs" />
<Compile Include="Serialization\DynamicValueProvider.cs" />
<Compile Include="Serialization\ErrorContext.cs" />
<Compile Include="Serialization\ErrorEventArgs.cs" />
<Compile Include="Serialization\ExpressionValueProvider.cs" />
<Compile Include="Serialization\IAttributeProvider.cs" />
<Compile Include="Serialization\IContractResolver.cs" />
<Compile Include="Serialization\IReferenceResolver.cs" />
<Compile Include="Serialization\ITraceWriter.cs" />
<Compile Include="Serialization\IValueProvider.cs" />
<Compile Include="Serialization\JsonArrayContract.cs" />
<Compile Include="Serialization\JsonContainerContract.cs" />
<Compile Include="Serialization\JsonContract.cs" />
<Compile Include="Serialization\JsonDictionaryContract.cs" />
<Compile Include="Serialization\JsonDynamicContract.cs" />
<Compile Include="Serialization\JsonFormatterConverter.cs" />
<Compile Include="Serialization\JsonISerializableContract.cs" />
<Compile Include="Serialization\JsonLinqContract.cs" />
<Compile Include="Serialization\JsonObjectContract.cs" />
<Compile Include="Serialization\JsonPrimitiveContract.cs" />
<Compile Include="Serialization\JsonProperty.cs" />
<Compile Include="Serialization\JsonPropertyCollection.cs" />
<Compile Include="Serialization\JsonSerializerInternalBase.cs" />
<Compile Include="Serialization\JsonSerializerInternalReader.cs" />
<Compile Include="Serialization\JsonSerializerInternalWriter.cs" />
<Compile Include="Serialization\JsonSerializerProxy.cs" />
<Compile Include="Serialization\JsonStringContract.cs" />
<Compile Include="Serialization\JsonTypeReflector.cs" />
<Compile Include="Serialization\ObjectConstructor.cs" />
<Compile Include="Serialization\OnErrorAttribute.cs" />
<Compile Include="Serialization\ReflectionAttributeProvider.cs" />
<Compile Include="Serialization\ReflectionValueProvider.cs" />
<Compile Include="Serialization\DiagnosticsTraceWriter.cs" />
<Compile Include="Serialization\MemoryTraceWriter.cs" />
<Compile Include="Serialization\TraceJsonReader.cs" />
<Compile Include="Serialization\TraceJsonWriter.cs" />
<Compile Include="MetadataPropertyHandling.cs" />
<Compile Include="StringEscapeHandling.cs" />
<Compile Include="TraceLevel.cs" />
<Compile Include="TypeNameHandling.cs" />
<Compile Include="Utilities\Base64Encoder.cs" />
<Compile Include="Utilities\BidirectionalDictionary.cs" />
<Compile Include="Utilities\CollectionUtils.cs" />
<Compile Include="Utilities\CollectionWrapper.cs" />
<Compile Include="Utilities\ConvertUtils.cs" />
<Compile Include="Utilities\DateTimeParser.cs" />
<Compile Include="Utilities\DateTimeUtils.cs" />
<Compile Include="Utilities\DictionaryWrapper.cs" />
<Compile Include="Utilities\DynamicProxy.cs" />
<Compile Include="Utilities\DynamicProxyMetaObject.cs" />
<Compile Include="Utilities\DynamicReflectionDelegateFactory.cs" />
<Compile Include="Utilities\DynamicUtils.cs" />
<Compile Include="Utilities\EnumUtils.cs" />
<Compile Include="Utilities\EnumValue.cs" />
<Compile Include="Utilities\ExpressionReflectionDelegateFactory.cs" />
<Compile Include="Utilities\ILGeneratorExtensions.cs" />
<Compile Include="Utilities\ImmutableCollectionsUtils.cs" />
<Compile Include="Utilities\JavaScriptUtils.cs" />
<Compile Include="Utilities\JsonTokenUtils.cs" />
<Compile Include="Utilities\LateBoundReflectionDelegateFactory.cs" />
<Compile Include="Utilities\LinqBridge.cs" />
<Compile Include="Utilities\MathUtils.cs" />
<Compile Include="Utilities\MethodCall.cs" />
<Compile Include="Utilities\MiscellaneousUtils.cs" />
<Compile Include="Utilities\PropertyNameTable.cs" />
<Compile Include="Utilities\ReflectionDelegateFactory.cs" />
<Compile Include="Utilities\ReflectionObject.cs" />
<Compile Include="Utilities\ReflectionUtils.cs" />
<Compile Include="Utilities\StringBuffer.cs" />
<Compile Include="Utilities\StringReference.cs" />
<Compile Include="Utilities\StringUtils.cs" />
<Compile Include="Utilities\ThreadSafeStore.cs" />
<Compile Include="Utilities\TypeExtensions.cs" />
<Compile Include="Utilities\ValidationUtils.cs" />
<Compile Include="WriteState.cs" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -36,8 +36,8 @@ using System.Security;
[assembly: AssemblyTitle("Json.NET Portable .NET 4.0")]
#elif PORTABLE
[assembly: AssemblyTitle("Json.NET Portable")]
#elif NETFX_CORE
[assembly: AssemblyTitle("Json.NET WinRT")]
#elif DOTNET
[assembly: AssemblyTitle("Json.NET .NET Platform")]
#elif NET20
[assembly: AssemblyTitle("Json.NET .NET 2.0")]
[assembly: AllowPartiallyTrustedCallers]
@@ -92,5 +92,5 @@ using System.Security;
// by using the '*' as shown below:
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.1.18621")]
[assembly: AssemblyFileVersion("7.0.2.18802")]
[assembly: CLSCompliant(true)]
@@ -36,7 +36,7 @@ namespace Newtonsoft.Json.Schema
/// JSON Schema validation has been moved to its own package. See <see href="http://www.newtonsoft.com/jsonschema">http://www.newtonsoft.com/jsonschema</see> for more details.
/// </note>
/// </summary>
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
[Serializable]
#endif
[Obsolete("JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details.")]
@@ -89,7 +89,7 @@ namespace Newtonsoft.Json.Schema
{
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
/// </summary>
@@ -187,7 +187,7 @@ namespace Newtonsoft.Json.Schema
if (containerAttribute != null && !string.IsNullOrEmpty(containerAttribute.Description))
return containerAttribute.Description;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute<DescriptionAttribute>(type);
if (descriptionAttribute != null)
return descriptionAttribute.Description;
@@ -335,7 +335,7 @@ namespace Newtonsoft.Json.Schema
}
}
break;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
case JsonContractType.Serializable:
CurrentSchema.Type = AddNullType(JsonSchemaType.Object, valueRequired);
CurrentSchema.Id = GetTypeId(type, false);
@@ -394,7 +394,7 @@ namespace Newtonsoft.Json.Schema
CurrentSchema.AllowAdditionalProperties = false;
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
private void GenerateISerializableContract(Type type, JsonISerializableContract contract)
{
CurrentSchema.AllowAdditionalProperties = true;
@@ -435,7 +435,7 @@ namespace Newtonsoft.Json.Schema
case PrimitiveTypeCode.Empty:
case PrimitiveTypeCode.Object:
return schemaType | JsonSchemaType.String;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
case PrimitiveTypeCode.DBNull:
return schemaType | JsonSchemaType.Null;
#endif
@@ -37,7 +37,7 @@ using System.Dynamic;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System.Security.Permissions;
#endif
using System.Xml.Serialization;
@@ -106,7 +106,7 @@ namespace Newtonsoft.Json.Serialization
private static readonly JsonConverter[] BuiltInConverters =
{
#if !(NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(NET20 || DOTNET || PORTABLE40 || PORTABLE)
new EntityKeyMemberConverter(),
#endif
#if !(NET35 || NET20 || PORTABLE40)
@@ -115,15 +115,12 @@ namespace Newtonsoft.Json.Serialization
#if !(PORTABLE40)
new XmlNodeConverter(),
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
new BinaryConverter(),
new DataSetConverter(),
new DataTableConverter(),
#endif
#if NETFX_CORE
new JsonValueConverter(),
#endif
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
new DiscriminatedUnionConverter(),
#endif
new KeyValuePairConverter(),
@@ -149,7 +146,7 @@ namespace Newtonsoft.Json.Serialization
get { return JsonTypeReflector.DynamicCodeGeneration; }
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
/// <summary>
/// Gets or sets the default members search flags.
/// </summary>
@@ -157,7 +154,7 @@ namespace Newtonsoft.Json.Serialization
[ObsoleteAttribute("DefaultMembersSearchFlags is obsolete. To modify the members serialized inherit from DefaultContractResolver and override the GetSerializableMembers method instead.")]
public BindingFlags DefaultMembersSearchFlags { get; set; }
#else
private BindingFlags DefaultMembersSearchFlags = BindingFlags.Instance | BindingFlags.Public;
private BindingFlags DefaultMembersSearchFlags;
#endif
/// <summary>
@@ -168,7 +165,7 @@ namespace Newtonsoft.Json.Serialization
/// </value>
public bool SerializeCompilerGeneratedMembers { get; set; }
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
/// <summary>
/// Gets or sets a value indicating whether to ignore the <see cref="ISerializable"/> interface when serializing and deserializing types.
/// </summary>
@@ -191,14 +188,13 @@ namespace Newtonsoft.Json.Serialization
/// </summary>
public DefaultContractResolver()
{
#if !NETFX_CORE
#pragma warning disable 618
DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance;
#pragma warning restore 618
#endif
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
IgnoreSerializableAttribute = true;
#endif
#pragma warning disable 618
DefaultMembersSearchFlags = BindingFlags.Instance | BindingFlags.Public;
#pragma warning restore 618
}
/// <summary>
@@ -268,7 +264,7 @@ namespace Newtonsoft.Json.Serialization
protected virtual List<MemberInfo> GetSerializableMembers(Type objectType)
{
bool ignoreSerializableAttribute;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
ignoreSerializableAttribute = IgnoreSerializableAttribute;
#else
ignoreSerializableAttribute = true;
@@ -366,7 +362,7 @@ namespace Newtonsoft.Json.Serialization
InitializeContract(contract);
bool ignoreSerializableAttribute;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
ignoreSerializableAttribute = IgnoreSerializableAttribute;
#else
ignoreSerializableAttribute = true;
@@ -393,7 +389,7 @@ namespace Newtonsoft.Json.Serialization
}
else if (contract.MemberSerialization == MemberSerialization.Fields)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object
// note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust
if (JsonTypeReflector.FullyTrusted)
@@ -832,7 +828,7 @@ namespace Newtonsoft.Json.Serialization
if (t.IsGenericType() && t.GetGenericTypeDefinition() == typeof(ConcurrentDictionary<,>))
return true;
#endif
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (t.Name == FSharpUtils.FSharpSetTypeName || t.Name == FSharpUtils.FSharpMapTypeName)
return true;
#endif
@@ -842,11 +838,11 @@ namespace Newtonsoft.Json.Serialization
private static bool ShouldSkipSerializing(Type t)
{
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (t.Name == FSharpUtils.FSharpSetTypeName || t.Name == FSharpUtils.FSharpMapTypeName)
return true;
#endif
#if NETFX_CORE
#if DOTNET
if (t.IsGenericType() && t.GetGenericTypeDefinition() == typeof(ConcurrentDictionary<,>))
return true;
#endif
@@ -924,7 +920,7 @@ namespace Newtonsoft.Json.Serialization
return contract;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
/// <summary>
/// Creates a <see cref="JsonISerializableContract"/> for the given type.
/// </summary>
@@ -1012,7 +1008,7 @@ namespace Newtonsoft.Json.Serialization
if (CanConvertToString(t))
return CreateStringContract(objectType);
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (!IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(t))
return CreateISerializableContract(objectType);
#endif
@@ -1022,7 +1018,7 @@ namespace Newtonsoft.Json.Serialization
return CreateDynamicContract(objectType);
#endif
#if !(PORTABLE || NETFX_CORE)
#if !PORTABLE
// tested last because it is not possible to automatically deserialize custom IConvertible types
if (IsIConvertible(t))
return CreatePrimitiveContract(t);
@@ -1038,7 +1034,7 @@ namespace Newtonsoft.Json.Serialization
return (typeCode != PrimitiveTypeCode.Empty && typeCode != PrimitiveTypeCode.Object);
}
#if !(PORTABLE || NETFX_CORE)
#if !PORTABLE
internal static bool IsIConvertible(Type t)
{
if (typeof(IConvertible).IsAssignableFrom(t)
@@ -1053,7 +1049,7 @@ namespace Newtonsoft.Json.Serialization
internal static bool CanConvertToString(Type type)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
TypeConverter converter = ConvertUtils.GetConverter(type);
// use the objectType's TypeConverter if it has one and can convert to a string
@@ -1160,7 +1156,7 @@ namespace Newtonsoft.Json.Serialization
// warning - this method use to cause errors with Intellitrace. Retest in VS Ultimate after changes
IValueProvider valueProvider;
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
if (DynamicCodeGeneration)
valueProvider = new DynamicValueProvider(member);
else
@@ -1268,7 +1264,7 @@ namespace Newtonsoft.Json.Serialization
JsonTypeReflector.GetAttribute<JsonIgnoreAttribute>(attributeProvider) != null
// automatically ignore extension data dictionary property if it is public
|| JsonTypeReflector.GetAttribute<JsonExtensionDataAttribute>(attributeProvider) != null
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
|| JsonTypeReflector.GetAttribute<NonSerializedAttribute>(attributeProvider) != null
#endif
;
@@ -49,19 +49,19 @@ namespace Newtonsoft.Json.Serialization
{
Assembly assembly;
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
// look, I don't like using obsolete methods as much as you do but this is the only way
// Assembly.Load won't check the GAC for a partial name
#pragma warning disable 618,612
assembly = Assembly.LoadWithPartialName(assemblyName);
#pragma warning restore 618,612
#elif NETFX_CORE || PORTABLE
#elif DOTNET || PORTABLE
assembly = Assembly.Load(new AssemblyName(assemblyName));
#else
assembly = Assembly.Load(assemblyName);
#endif
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
if (assembly == null)
{
// will find assemblies loaded with Assembly.LoadFile outside of the main directory
@@ -145,7 +145,7 @@ namespace Newtonsoft.Json.Serialization
/// <param name="typeName">Specifies the <see cref="T:System.Type"/> name of the serialized object. </param>
public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
{
#if NETFX_CORE || PORTABLE
#if (DOTNET || PORTABLE)
assemblyName = serializedType.GetTypeInfo().Assembly.FullName;
typeName = serializedType.FullName;
#else
@@ -1,4 +1,4 @@
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
using System;
using System.Diagnostics;
using DiagnosticsTrace = System.Diagnostics.Trace;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
using System;
using System.Collections.Generic;
#if NET20
@@ -165,7 +165,7 @@ namespace Newtonsoft.Json.Serialization
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(underlyingType, CollectionItemType);
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (!HasParametrizedCreator && underlyingType.Name == FSharpUtils.FSharpListTypeName)
{
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
@@ -148,7 +148,7 @@ namespace Newtonsoft.Json.Serialization
{
_parametrizedConstructor = CollectionUtils.ResolveEnumerableCollectionConstructor(CreatedType, typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType));
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20)
if (!HasParametrizedCreator && underlyingType.Name == FSharpUtils.FSharpMapTypeName)
{
FSharpUtils.EnsureInitialized(underlyingType.Assembly());
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Globalization;
using System.Runtime.Serialization;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System;
using System.Runtime.Serialization;
@@ -181,7 +181,7 @@ namespace Newtonsoft.Json.Serialization
CreatorParameters = new JsonPropertyCollection(UnderlyingType);
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35)
[SecuritySafeCritical]
#endif
@@ -43,13 +43,8 @@ namespace Newtonsoft.Json.Serialization
int IEqualityComparer<object>.GetHashCode(object obj)
{
#if !(NETFX_CORE)
// put objects in a bucket based on their reference
return RuntimeHelpers.GetHashCode(obj);
#else
// put all objects in the same bucket so ReferenceEquals is called on all
return -1;
#endif
}
}
@@ -291,7 +291,7 @@ namespace Newtonsoft.Json.Serialization
return EnsureType(reader, constructorName, CultureInfo.InvariantCulture, contract, objectType);
case JsonToken.Null:
case JsonToken.Undefined:
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (objectType == typeof(DBNull))
return DBNull.Value;
#endif
@@ -321,7 +321,7 @@ namespace Newtonsoft.Json.Serialization
{
case JsonContractType.Object:
case JsonContractType.Dictionary:
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
case JsonContractType.Serializable:
#endif
#if !(NET35 || NET20 || PORTABLE40)
@@ -508,7 +508,7 @@ namespace Newtonsoft.Json.Serialization
JsonDynamicContract dynamicContract = (JsonDynamicContract)contract;
return CreateDynamic(reader, dynamicContract, member, id);
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
case JsonContractType.Serializable:
JsonISerializableContract serializableContract = (JsonISerializableContract)contract;
return CreateISerializable(reader, serializableContract, member, id);
@@ -1444,7 +1444,7 @@ namespace Newtonsoft.Json.Serialization
return underlyingList;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, string id)
{
Type objectType = contract.UnderlyingType;
@@ -188,7 +188,7 @@ namespace Newtonsoft.Json.Serialization
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty);
break;
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
case JsonContractType.Serializable:
SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract, member, containerContract, containerProperty);
break;
@@ -331,7 +331,7 @@ namespace Newtonsoft.Json.Serialization
internal static bool TryConvertToString(object value, Type type, out string s)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
TypeConverter converter = ConvertUtils.GetConverter(type);
// use the objectType's TypeConverter if it has one and can convert to a string
@@ -347,12 +347,12 @@ namespace Newtonsoft.Json.Serialization
}
#endif
#if NETFX_CORE || PORTABLE
if (value is Guid || value is Uri || value is TimeSpan)
{
s = value.ToString();
return true;
}
#if (DOTNET || PORTABLE)
if (value is Guid || value is Uri || value is TimeSpan)
{
s = value.ToString();
return true;
}
#endif
if (value is Type)
@@ -739,7 +739,7 @@ namespace Newtonsoft.Json.Serialization
return writeMetadataObject;
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35)
[SecuritySafeCritical]
#endif
@@ -29,7 +29,7 @@ using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Security;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System.Security.Permissions;
#endif
using Newtonsoft.Json.Utilities;
@@ -59,7 +59,7 @@ namespace Newtonsoft.Json.Serialization
private static readonly ThreadSafeStore<Type, Func<object[], JsonConverter>> JsonConverterCreatorCache =
new ThreadSafeStore<Type, Func<object[], JsonConverter>>(GetJsonConverterCreator);
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
private static readonly ThreadSafeStore<Type, Type> AssociatedMetadataTypesCache = new ThreadSafeStore<Type, Type>(GetAssociateMetadataTypeFromAttribute);
private static ReflectionObject _metadataTypeAttributeReflectionObject;
#endif
@@ -131,7 +131,7 @@ namespace Newtonsoft.Json.Serialization
return MemberSerialization.OptIn;
#endif
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
if (!ignoreSerializableAttribute)
{
SerializableAttribute serializableAttribute = GetCachedAttribute<SerializableAttribute>(objectType);
@@ -214,14 +214,14 @@ namespace Newtonsoft.Json.Serialization
};
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
public static TypeConverter GetTypeConverter(Type type)
{
return TypeDescriptor.GetConverter(type);
}
#endif
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
private static Type GetAssociatedMetadataType(Type type)
{
return AssociatedMetadataTypesCache.Get(type);
@@ -256,7 +256,7 @@ namespace Newtonsoft.Json.Serialization
{
T attribute;
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
Type metadataType = GetAssociatedMetadataType(type);
if (metadataType != null)
{
@@ -284,7 +284,7 @@ namespace Newtonsoft.Json.Serialization
{
T attribute;
#if !(NET20 || NETFX_CORE)
#if !(NET20 || DOTNET)
Type metadataType = GetAssociatedMetadataType(memberInfo.DeclaringType);
if (metadataType != null)
{
@@ -348,14 +348,14 @@ namespace Newtonsoft.Json.Serialization
public static bool DynamicCodeGeneration
{
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE)
#if !(NET20 || NET35 || PORTABLE)
[SecuritySafeCritical]
#endif
get
{
if (_dynamicCodeGeneration == null)
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
try
{
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
@@ -384,7 +384,7 @@ namespace Newtonsoft.Json.Serialization
{
if (_fullyTrusted == null)
{
#if (NETFX_CORE || PORTABLE || PORTABLE40)
#if (DOTNET || PORTABLE || PORTABLE40)
_fullyTrusted = false;
#elif !(NET20 || NET35 || PORTABLE40)
AppDomain appDomain = AppDomain.CurrentDomain;
@@ -411,7 +411,7 @@ namespace Newtonsoft.Json.Serialization
{
get
{
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(PORTABLE40 || PORTABLE || DOTNET)
if (DynamicCodeGeneration)
return DynamicReflectionDelegateFactory.Instance;
+1 -1
View File
@@ -1,5 +1,5 @@

#if PocketPC || NETFX_CORE || PORTABLE40 || PORTABLE
#if (DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Reflection;
+1 -1
View File
@@ -1,5 +1,5 @@

#if (NETFX_CORE || PORTABLE40 || PORTABLE)
#if (DOTNET || PORTABLE40 || PORTABLE)
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json
+18 -18
View File
@@ -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);
@@ -57,7 +57,7 @@ namespace Newtonsoft.Json.Utilities
#endif
}
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
public static XmlDateTimeSerializationMode ToSerializationMode(DateTimeKind kind)
{
switch (kind)
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
using System;
using System.Collections.Generic;
#if NET20
+2 -2
View File
@@ -23,8 +23,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20)
using System.Threading;
#if !(NET35 || NET20 || NETFX_CORE)
using System;
using System.Collections.Generic;
using System.Linq;
@@ -112,7 +112,7 @@ namespace Newtonsoft.Json.Utilities
_mapType = fsharpCoreAssembly.GetType("Microsoft.FSharp.Collections.FSharpMap`2");
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
Thread.MemoryBarrier();
#endif
_initialized = true;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE40 || PORTABLE || NETFX_CORE)
#if !(DOTNET || PORTABLE40 || PORTABLE)
using System;
using System.Reflection.Emit;
using System.Reflection;
@@ -43,7 +43,7 @@ using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Utilities
{
#if (NETFX_CORE || PORTABLE || PORTABLE40)
#if (DOTNET || PORTABLE || PORTABLE40)
internal enum MemberTypes
{
Property = 0,
@@ -54,7 +54,7 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#if NETFX_CORE || PORTABLE
#if PORTABLE
[Flags]
internal enum BindingFlags
{
@@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Utilities
static ReflectionUtils()
{
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
#if !(PORTABLE40 || PORTABLE)
EmptyTypes = Type.EmptyTypes;
#else
EmptyTypes = new Type[0];
@@ -669,7 +669,7 @@ namespace Newtonsoft.Json.Utilities
return (attributes != null) ? attributes.FirstOrDefault() : null;
}
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
public static T[] GetAttributes<T>(object attributeProvider, bool inherit) where T : Attribute
{
Attribute[] a = GetAttributes(attributeProvider, typeof(T), inherit);
@@ -848,7 +848,7 @@ namespace Newtonsoft.Json.Utilities
ValidationUtils.ArgumentNotNull(targetType, "targetType");
List<MemberInfo> fieldInfos = new List<MemberInfo>(targetType.GetFields(bindingAttr));
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
// Type.GetFields doesn't return inherited private fields
// manually find private fields from base class
GetChildPrivateFields(fieldInfos, targetType, bindingAttr);
@@ -857,7 +857,7 @@ namespace Newtonsoft.Json.Utilities
return fieldInfos.Cast<FieldInfo>();
}
#if !(NETFX_CORE || PORTABLE)
#if !PORTABLE
private static void GetChildPrivateFields(IList<MemberInfo> initialFields, Type targetType, BindingFlags bindingAttr)
{
// fix weirdness with private FieldInfos only being returned for the current Type
+1 -1
View File
@@ -170,7 +170,7 @@ namespace Newtonsoft.Json.Utilities
if (i > 0 && hasNext && !char.IsUpper(chars[i + 1]))
break;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
chars[i] = char.ToLower(chars[i], CultureInfo.InvariantCulture);
#else
chars[i] = char.ToLowerInvariant(chars[i]);
@@ -78,7 +78,7 @@ namespace Newtonsoft.Json.Utilities
Dictionary<TKey, TValue> newStore = new Dictionary<TKey, TValue>(_store);
newStore[key] = value;
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
Thread.MemoryBarrier();
#endif
_store = newStore;
+27 -56
View File
@@ -36,7 +36,8 @@ namespace Newtonsoft.Json.Utilities
{
internal static class TypeExtensions
{
#if NETFX_CORE || PORTABLE
#if DOTNET || PORTABLE
#if !DOTNET
private static BindingFlags DefaultFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo)
@@ -66,29 +67,32 @@ namespace Newtonsoft.Json.Utilities
return null;
}
#endif
public static bool IsSubclassOf(this Type type, Type c)
{
return type.GetTypeInfo().IsSubclassOf(c);
}
#if !DOTNET
public static bool IsAssignableFrom(this Type type, Type c)
{
return type.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
}
#endif
public static bool IsInstanceOfType(this Type type, object o)
{
if (o == null)
return false;
return IsAssignableFrom(type, o.GetType());
return type.IsAssignableFrom(o.GetType());
}
#endif
public static MethodInfo Method(this Delegate d)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return d.Method;
#else
return d.GetMethodInfo();
@@ -97,7 +101,7 @@ namespace Newtonsoft.Json.Utilities
public static MemberTypes MemberType(this MemberInfo memberInfo)
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(DOTNET || PORTABLE || PORTABLE40)
return memberInfo.MemberType;
#else
if (memberInfo is PropertyInfo)
@@ -115,7 +119,7 @@ namespace Newtonsoft.Json.Utilities
public static bool ContainsGenericParameters(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.ContainsGenericParameters;
#else
return type.GetTypeInfo().ContainsGenericParameters;
@@ -124,7 +128,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsInterface(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsInterface;
#else
return type.GetTypeInfo().IsInterface;
@@ -133,7 +137,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsGenericType(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsGenericType;
#else
return type.GetTypeInfo().IsGenericType;
@@ -142,7 +146,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsGenericTypeDefinition(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsGenericTypeDefinition;
#else
return type.GetTypeInfo().IsGenericTypeDefinition;
@@ -151,7 +155,7 @@ namespace Newtonsoft.Json.Utilities
public static Type BaseType(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.BaseType;
#else
return type.GetTypeInfo().BaseType;
@@ -160,7 +164,7 @@ namespace Newtonsoft.Json.Utilities
public static Assembly Assembly(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.Assembly;
#else
return type.GetTypeInfo().Assembly;
@@ -169,7 +173,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsEnum(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsEnum;
#else
return type.GetTypeInfo().IsEnum;
@@ -178,7 +182,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsClass(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsClass;
#else
return type.GetTypeInfo().IsClass;
@@ -187,17 +191,17 @@ namespace Newtonsoft.Json.Utilities
public static bool IsSealed(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsSealed;
#else
return type.GetTypeInfo().IsSealed;
#endif
}
#if PORTABLE40
#if (PORTABLE40 || DOTNET || PORTABLE)
public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingFlags, object placeholder1, Type propertyType, IList<Type> indexParameters, object placeholder2)
{
IList<PropertyInfo> propertyInfos = type.GetProperties(bindingFlags);
IEnumerable<PropertyInfo> propertyInfos = type.GetProperties(bindingFlags);
return propertyInfos.Where(p =>
{
@@ -217,10 +221,8 @@ namespace Newtonsoft.Json.Utilities
public static IEnumerable<MemberInfo> GetMember(this Type type, string name, MemberTypes memberType, BindingFlags bindingFlags)
{
return type.GetMembers(bindingFlags).Where(m =>
return type.GetMember(name, bindingFlags).Where(m =>
{
if (name != null && name != m.Name)
return false;
if (m.MemberType() != memberType)
return false;
@@ -229,19 +231,20 @@ namespace Newtonsoft.Json.Utilities
}
#endif
#if (NETFX_CORE || PORTABLE)
#if (DOTNET || PORTABLE)
public static MethodInfo GetBaseDefinition(this MethodInfo method)
{
return method.GetRuntimeBaseDefinition();
}
#endif
#if (NETFX_CORE || PORTABLE)
#if (DOTNET || PORTABLE)
public static bool IsDefined(this Type type, Type attributeType, bool inherit)
{
return type.GetTypeInfo().CustomAttributes.Any(a => a.AttributeType == attributeType);
}
#if !DOTNET
public static MethodInfo GetMethod(this Type type, string name)
{
return type.GetMethod(name, DefaultFlags);
@@ -276,39 +279,6 @@ namespace Newtonsoft.Json.Utilities
}).SingleOrDefault();
}
public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingFlags, object placeholder1, Type propertyType, IList<Type> indexParameters, object placeholder2)
{
return type.GetTypeInfo().DeclaredProperties.Where(p =>
{
if (name != null && name != p.Name)
return false;
if (propertyType != null && propertyType != p.PropertyType)
return false;
if (indexParameters != null)
{
if (!p.GetIndexParameters().Select(ip => ip.ParameterType).SequenceEqual(indexParameters))
return false;
}
return true;
}).SingleOrDefault();
}
public static IEnumerable<MemberInfo> GetMember(this Type type, string name, MemberTypes memberType, BindingFlags bindingFlags)
{
return type.GetTypeInfo().GetMembersRecursive().Where(m =>
{
if (name != null && name != m.Name)
return false;
if (m.MemberType() != memberType)
return false;
if (!TestAccessibility(m, bindingFlags))
return false;
return true;
});
}
public static IEnumerable<ConstructorInfo> GetConstructors(this Type type)
{
return type.GetConstructors(DefaultFlags);
@@ -517,11 +487,12 @@ namespace Newtonsoft.Json.Utilities
{
return type.GetTypeInfo().DeclaredMethods;
}
#endif
#endif
public static bool IsAbstract(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsAbstract;
#else
return type.GetTypeInfo().IsAbstract;
@@ -530,7 +501,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsVisible(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsVisible;
#else
return type.GetTypeInfo().IsVisible;
@@ -539,7 +510,7 @@ namespace Newtonsoft.Json.Utilities
public static bool IsValueType(this Type type)
{
#if !(NETFX_CORE || PORTABLE)
#if !(DOTNET || PORTABLE)
return type.IsValueType;
#else
return type.GetTypeInfo().IsValueType;
+36
View File
@@ -0,0 +1,36 @@
{
"version": "7.0.2-beta1-*",
"description": "Json.NET is a popular high-performance JSON framework for .NET",
"authors": [ "James Newton-King" ],
"tags": [ "json" ],
"projectUrl": "http://www.newtonsoft.com/json",
"licenseUrl": "https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md",
"frameworks": {
"dotnet": {
"dependencies": {
"Microsoft.CSharp": "4.0.0-beta-*",
"System.Collections": "4.0.10-beta-*",
"System.Collections.Concurrent": "4.0.10-beta-*",
"System.ComponentModel.TypeConverter": "4.0.0-beta-*",
"System.Diagnostics.Debug": "4.0.10-beta-*",
"System.Diagnostics.Tools": "4.0.0-beta-*",
"System.Dynamic.Runtime": "4.0.10-beta-*",
"System.Globalization": "4.0.10-beta-*",
"System.IO": "4.0.10-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Linq.Expressions": "4.0.10-beta-*",
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Runtime.Numerics": "4.0.0-beta-*",
"System.Runtime.Serialization.Primitives": "4.0.10-beta-*",
"System.Text.Encoding": "4.0.10-beta-*",
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
"System.Text.RegularExpressions": "4.0.10-beta-*",
"System.Threading": "4.0.10-beta-*",
"System.Xml.ReaderWriter": "4.0.10-beta-*",
"System.Xml.XDocument": "4.0.10-beta-*"
}
}
}
}