-Upgraded Silverlight project to Silverlight 4

-Included .NET 4 features in Silverlight project
This commit is contained in:
JamesNK
2011-01-03 05:19:57 +00:00
parent 1aa3ff31a1
commit a96f4d4248
18 changed files with 134 additions and 51 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
using System.Linq.Expressions;
#endif
@@ -654,7 +654,7 @@ namespace Newtonsoft.Json.Linq
#endregion
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
/// <summary>
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
/// </summary>
+3 -3
View File
@@ -25,7 +25,7 @@
using System;
using System.Collections.Generic;
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
using System.Linq.Expressions;
#endif
@@ -46,7 +46,7 @@ namespace Newtonsoft.Json.Linq
#if !SILVERLIGHT
, ICloneable
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
, IDynamicMetaObjectProvider
#endif
{
@@ -1276,7 +1276,7 @@ namespace Newtonsoft.Json.Linq
return p.Evaluate(this, errorWhenNoMatch);
}
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
/// <summary>
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
/// </summary>
+3 -12
View File
@@ -30,7 +30,7 @@ using System.Text;
using Newtonsoft.Json.Utilities;
using System.Globalization;
using System.ComponentModel;
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
using System.Linq.Expressions;
#endif
@@ -406,7 +406,7 @@ namespace Newtonsoft.Json.Linq
return _value.GetHashCode();
}
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
/// <summary>
/// Returns the <see cref="T:System.Dynamic.DynamicMetaObject"/> responsible for binding operations performed on this object.
/// </summary>
@@ -437,16 +437,7 @@ namespace Newtonsoft.Json.Linq
return ReflectionUtils.IsNullable(binder.Type);
}
Type t = binder.Type;
if (ReflectionUtils.IsNullableType(t))
t = Nullable.GetUnderlyingType(t);
TypeConverter converter = TypeDescriptor.GetConverter(instance.Value);
if (converter != null && converter.CanConvertTo(t))
result = converter.ConvertTo(instance.Value, t);
else
result = Convert.ChangeType(instance.Value, t, CultureInfo.InvariantCulture);
result = ConvertUtils.Convert(instance.Value, CultureInfo.InvariantCulture, binder.Type);
return true;
}
}
@@ -14,7 +14,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json</RootNamespace>
<AssemblyName>Newtonsoft.Json.Silverlight</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>false</ThrowErrorsInValidation>
@@ -191,7 +191,10 @@
<Compile Include="Utilities\ConvertUtils.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\DynamicWrapper.cs" />
<Compile Include="Utilities\EnumUtils.cs" />
<Compile Include="Utilities\EnumValue.cs" />
@@ -27,7 +27,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
#endif
using System.Globalization;
@@ -86,8 +86,10 @@ namespace Newtonsoft.Json.Serialization
#endif
new BinaryConverter(),
new KeyValuePairConverter(),
#if !SILVERLIGHT
#if !SILVERLIGHT || WINDOWS_PHONE
new XmlNodeConverter(),
#endif
#if !SILVERLIGHT
new DataSetConverter(),
new DataTableConverter(),
#endif
@@ -450,7 +452,7 @@ namespace Newtonsoft.Json.Serialization
}
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
/// <summary>
/// Creates a <see cref="JsonDynamicContract"/> for the given type.
/// </summary>
@@ -515,7 +517,7 @@ namespace Newtonsoft.Json.Serialization
return CreateISerializableContract(t);
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(t))
return CreateDynamicContract(t);
#endif
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System;
using System.Collections.Generic;
using System.Reflection;
@@ -27,7 +27,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
#endif
using System.Globalization;
@@ -406,7 +406,7 @@ namespace Newtonsoft.Json.Serialization
}
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
JsonDynamicContract dynamicContract = contract as JsonDynamicContract;
if (dynamicContract != null)
{
@@ -456,7 +456,11 @@ namespace Newtonsoft.Json.Serialization
private bool HasDefinedType(Type type)
{
return (type != null && type != typeof (object) && !type.IsSubclassOf(typeof(JToken)));
return (type != null && type != typeof (object) && !typeof(JToken).IsAssignableFrom(type)
#if !(NET35 || NET20 || WINDOWS_PHONE)
&& type != typeof(IDynamicMetaObjectProvider)
#endif
);
}
private object EnsureType(object value, Type targetType)
@@ -762,7 +766,7 @@ namespace Newtonsoft.Json.Serialization
}
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
private object CreateDynamic(JsonReader reader, JsonDynamicContract contract, string id)
{
IDynamicMetaObjectProvider newObject = null;
@@ -799,9 +803,9 @@ namespace Newtonsoft.Json.Serialization
}
else
{
object value = (JsonReader.IsPrimitiveToken(reader.TokenType))
? reader.Value
: CreateObject(reader, typeof(IDynamicMetaObjectProvider), GetContractSafe(typeof(IDynamicMetaObjectProvider), null), null, null);
Type t = (JsonReader.IsPrimitiveToken(reader.TokenType)) ? reader.ValueType : typeof (IDynamicMetaObjectProvider);
object value = CreateValueNonProperty(reader, t, GetContractSafe(t, null));
newObject.TrySetMember(memberName, value);
}
@@ -27,7 +27,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
#endif
using System.Globalization;
@@ -136,7 +136,7 @@ namespace Newtonsoft.Json.Serialization
SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract);
}
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
else if (valueContract is JsonDynamicContract)
{
SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract);
@@ -474,7 +474,7 @@ namespace Newtonsoft.Json.Serialization
}
#endif
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
private void SerializeDynamic(JsonWriter writer, IDynamicMetaObjectProvider value, JsonDynamicContract contract)
{
contract.InvokeOnSerializing(value, Serializer.Context);
@@ -1,4 +1,4 @@
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System;
using System.Collections.Generic;
using System.Dynamic;
@@ -1,4 +1,4 @@
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System;
using System.Collections.Generic;
using System.Dynamic;
@@ -1,4 +1,4 @@
#if !(NET35 || NET20 || SILVERLIGHT)
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System;
using System.Collections.Generic;
using System.Dynamic;
@@ -8,6 +8,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Globalization;
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Utilities
{
@@ -70,10 +71,10 @@ namespace Newtonsoft.Json.Utilities
Type csharpArgumentInfoTypeEnumerableType = typeof(IEnumerable<>).MakeGenericType(csharpArgumentInfoType);
MethodInfo getMemberMethod = binderType.GetMethod("GetMember", BindingFlags.Public | BindingFlags.Static, null, new[] { csharpBinderFlagsType, typeof(string), typeof(Type), csharpArgumentInfoTypeEnumerableType }, null);
_getMemberCall = DynamicReflectionDelegateFactory.Instance.CreateMethodCall<object>(getMemberMethod);
_getMemberCall = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall<object>(getMemberMethod);
MethodInfo setMemberMethod = binderType.GetMethod("SetMember", BindingFlags.Public | BindingFlags.Static, null, new[] { csharpBinderFlagsType, typeof(string), typeof(Type), csharpArgumentInfoTypeEnumerableType }, null);
_setMemberCall = DynamicReflectionDelegateFactory.Instance.CreateMethodCall<object>(setMemberMethod);
_setMemberCall = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall<object>(setMemberMethod);
}
public static CallSiteBinder GetMember(string name, Type context)