-Fixed JsonNet35BinaryCompatibility spelling
-Fixed Specified properties incorrectly needing XmlIgnore attribute
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
byte[] data = MiscellaneousUtils.HexToBytes("8C-00-00-00-12-30-00-FF-FF-FF-FF-FF-FF-FF-7F-12-31-00-FF-FF-FF-FF-FF-FF-FF-7F-10-32-00-FF-FF-FF-7F-10-33-00-FF-FF-FF-7F-10-34-00-FF-00-00-00-10-35-00-7F-00-00-00-02-36-00-02-00-00-00-61-00-01-37-00-00-00-00-00-00-00-F0-45-01-38-00-FF-FF-FF-FF-FF-FF-EF-7F-01-39-00-00-00-00-E0-FF-FF-EF-47-08-31-30-00-01-05-31-31-00-05-00-00-00-02-00-01-02-03-04-09-31-32-00-40-C5-E2-BA-E3-00-00-00-09-31-33-00-40-C5-E2-BA-E3-00-00-00-00");
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BsonReader reader = new BsonReader(ms);
|
||||
reader.JsonNet35BinaryCompadibility = true;
|
||||
reader.JsonNet35BinaryCompatibility = true;
|
||||
reader.ReadRootValueAsArray = true;
|
||||
reader.DateTimeKindHandling = DateTimeKind.Utc;
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BsonReader reader = new BsonReader(ms, true, DateTimeKind.Utc);
|
||||
reader.JsonNet35BinaryCompadibility = true;
|
||||
reader.JsonNet35BinaryCompatibility = true;
|
||||
|
||||
Assert.AreEqual(true, reader.ReadRootValueAsArray);
|
||||
Assert.AreEqual(DateTimeKind.Utc, reader.DateTimeKindHandling);
|
||||
@@ -385,7 +385,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
byte[] data = MiscellaneousUtils.HexToBytes(hexdoc);
|
||||
|
||||
BsonReader reader = new BsonReader(new MemoryStream(data));
|
||||
reader.JsonNet35BinaryCompadibility = true;
|
||||
reader.JsonNet35BinaryCompatibility = true;
|
||||
|
||||
JObject o = (JObject)JToken.ReadFrom(reader);
|
||||
Assert.AreEqual(3, o.Count);
|
||||
@@ -406,7 +406,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
"82-00-00-00-07-5F-69-64-00-4A-78-93-79-17-22-00-00-00-00-61-CF-04-61-00-5D-00-00-00-01-30-00-00-00-00-00-00-00-F0-3F-01-31-00-00-00-00-00-00-00-00-40-01-32-00-00-00-00-00-00-00-08-40-01-33-00-00-00-00-00-00-00-10-40-01-34-00-00-00-00-00-00-00-14-50-01-35-00-00-00-00-00-00-00-18-40-01-36-00-00-00-00-00-00-00-1C-40-01-37-00-00-00-00-00-00-00-20-40-00-02-62-00-05-00-00-00-74-65-73-74-00-00");
|
||||
|
||||
BsonReader reader1 = new BsonReader(new MemoryStream(data1));
|
||||
reader1.JsonNet35BinaryCompadibility = true;
|
||||
reader1.JsonNet35BinaryCompatibility = true;
|
||||
|
||||
// oid
|
||||
JObject o1 = (JObject)JToken.ReadFrom(reader1);
|
||||
@@ -415,7 +415,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
"87-00-00-00-05-5F-69-64-00-0C-00-00-00-02-4A-78-93-79-17-22-00-00-00-00-61-CF-04-61-00-5D-00-00-00-01-30-00-00-00-00-00-00-00-F0-3F-01-31-00-00-00-00-00-00-00-00-40-01-32-00-00-00-00-00-00-00-08-40-01-33-00-00-00-00-00-00-00-10-40-01-34-00-00-00-00-00-00-00-14-50-01-35-00-00-00-00-00-00-00-18-40-01-36-00-00-00-00-00-00-00-1C-40-01-37-00-00-00-00-00-00-00-20-40-00-02-62-00-05-00-00-00-74-65-73-74-00-00");
|
||||
|
||||
BsonReader reader2 = new BsonReader(new MemoryStream(data2));
|
||||
reader2.JsonNet35BinaryCompadibility = true;
|
||||
reader2.JsonNet35BinaryCompatibility = true;
|
||||
|
||||
// bytes
|
||||
JObject o2 = (JObject)JToken.ReadFrom(reader2);
|
||||
|
||||
@@ -3477,14 +3477,14 @@ keyword such as type of business.""
|
||||
|
||||
// Console.WriteLine(sw.ToString());
|
||||
|
||||
//// string xml = @"<?xml version=""1.0"" encoding=""utf-16""?>
|
||||
////<OptionalOrder xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
|
||||
//// <FirstOrder>First</FirstOrder>
|
||||
////</OptionalOrder>";
|
||||
// // string xml = @"<?xml version=""1.0"" encoding=""utf-16""?>
|
||||
// //<OptionalOrder xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
|
||||
// // <FirstOrder>First</FirstOrder>
|
||||
// //</OptionalOrder>";
|
||||
|
||||
//// OptionalOrder o = (OptionalOrder)s.Deserialize(new StringReader(xml));
|
||||
//// Console.WriteLine(o.FirstOrder);
|
||||
//// Console.WriteLine(o.FirstOrderSpecified);
|
||||
// // OptionalOrder o = (OptionalOrder)s.Deserialize(new StringReader(xml));
|
||||
// // Console.WriteLine(o.FirstOrder);
|
||||
// // Console.WriteLine(o.FirstOrderSpecified);
|
||||
// }
|
||||
|
||||
public class OptionalOrder
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Newtonsoft.Json.Bson
|
||||
private ContainerContext _currentContext;
|
||||
|
||||
private bool _readRootValueAsArray;
|
||||
private bool _jsonNet35BinaryCompadibility;
|
||||
private bool _jsonNet35BinaryCompatibility;
|
||||
private DateTimeKind _dateTimeKindHandling;
|
||||
|
||||
private enum BsonReaderState
|
||||
@@ -89,10 +89,10 @@ namespace Newtonsoft.Json.Bson
|
||||
/// <value>
|
||||
/// <c>true</c> if binary data reading will be compatible with incorrect Json.NET 3.5 written binary; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool JsonNet35BinaryCompadibility
|
||||
public bool JsonNet35BinaryCompatibility
|
||||
{
|
||||
get { return _jsonNet35BinaryCompadibility; }
|
||||
set { _jsonNet35BinaryCompadibility = value; }
|
||||
get { return _jsonNet35BinaryCompatibility; }
|
||||
set { _jsonNet35BinaryCompatibility = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -543,7 +543,7 @@ namespace Newtonsoft.Json.Bson
|
||||
|
||||
#pragma warning disable 612,618
|
||||
// the old binary type has the data length repeated in the data for some reason
|
||||
if (binaryType == BsonBinaryType.Data && !_jsonNet35BinaryCompadibility)
|
||||
if (binaryType == BsonBinaryType.Data && !_jsonNet35BinaryCompatibility)
|
||||
{
|
||||
dataLength = ReadInt32();
|
||||
}
|
||||
|
||||
@@ -742,9 +742,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
if (specifiedMember == null)
|
||||
specifiedMember = member.DeclaringType.GetField(member.Name + JsonTypeReflector.SpecifiedPostfix);
|
||||
|
||||
if (specifiedMember == null || ReflectionUtils.GetMemberUnderlyingType(specifiedMember) != typeof(bool)
|
||||
|| (ReflectionUtils.GetAttribute<XmlIgnoreAttribute>(specifiedMember) == null
|
||||
&& ReflectionUtils.GetAttribute<JsonIgnoreAttribute>(specifiedMember) == null))
|
||||
if (specifiedMember == null || ReflectionUtils.GetMemberUnderlyingType(specifiedMember) != typeof(bool))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user