diff --git a/CHANGES.txt b/CHANGES.txt
index b569bf562..57a4148aa 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -707,10 +707,19 @@ Release 0.9.1 2017-8-30
BUG FIXES
* Fix ByteArrayPacker throws IndexOutOfBoundException when the buffer remaining bytes is equal to packed scalar size. #252
+Release 0.9.2 2017-09-26
+
+ BUG FIXES
+ * Fix UAP build drop does not exists in nupkg. #186
+
Release 1.0.0-beta1 T.B.D.
NEW FEATURES
* .NET Standard 2.0 which supports serializer source code generation on .NET Core. Note that serializer assembly generation is not supported.
+ * MessagePackSerializer.UnpackMessagePackObject(byte[]) utility method.
+ * MessagePack timestamp type support. This includes interoperability with DateTime/DateTimeOffset as well as MsgPack.Timespan type with basic arithmatics, properties, and conversions.
BUG FIXES
* Fix ByteArrayPacker throws IndexOutOfBoundException when the buffer remaining bytes is equal to packed scalar size. #252
+ * Fix UAP build drop does not exists in nupkg. #186
+ * Fix new unpacker cannot unpack reserved ext types.
diff --git a/MsgPack.Windows.sln b/MsgPack.Windows.sln
index 4d42f5010..0474bd60e 100644
--- a/MsgPack.Windows.sln
+++ b/MsgPack.Windows.sln
@@ -385,7 +385,8 @@ Global
{9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|Any CPU.Build.0 = Release|Any CPU
{9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|ARM.ActiveCfg = Release|ARM
{9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|ARM.Build.0 = Release|ARM
- {9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|x64.ActiveCfg = Release|x64
{9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|x64.Build.0 = Release|x64
{9D65A105-FB03-40DB-9185-8C695B8EE8D6}.Release|x86.ActiveCfg = Release|x86
diff --git a/Sync.json b/Sync.json
index ddada6d03..3ad947057 100644
--- a/Sync.json
+++ b/Sync.json
@@ -67,6 +67,7 @@
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/SimdTypeSerializers.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/System_Numerics_ComplexMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/System_Security_Cryptography_HashAlgorithmNameMessagePackSerializer.cs"},
+ {"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/TimestampFileTimeMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/UnixEpocFileTimeMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/ReflectionSerializers/ReflectionTupleMessagePackSerializer`1.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/ReflectionExtensions.ConstructorDelegate.cs"},
@@ -117,6 +118,7 @@
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/System_Collections_StackMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/System_Collections_Specialized_NameValueCollectionMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/System_Security_Cryptography_HashAlgorithmNameMessagePackSerializer.cs"},
+ {"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/TimestampFileTimeMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/Serialization/DefaultSerializers/UnixEpocFileTimeMessagePackSerializer.cs"},
{"type": "remove", "path": "../MsgPack/BufferedStream.cs"},
{"type": "remove", "path": "../MsgPack/NetStandardCompatibility.cs"},
diff --git a/samples/Samples/Samples.csproj b/samples/Samples/Samples.csproj
index d8277b439..6e669d52e 100644
--- a/samples/Samples/Samples.csproj
+++ b/samples/Samples/Samples.csproj
@@ -33,8 +33,8 @@
4
-
- ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll
+
+ ..\..\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll
diff --git a/samples/Samples/packages.config b/samples/Samples/packages.config
index 4b26cc066..0ee860b3f 100644
--- a/samples/Samples/packages.config
+++ b/samples/Samples/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/MsgPack.Silverlight.5/MsgPack.Silverlight.5.csproj b/src/MsgPack.Silverlight.5/MsgPack.Silverlight.5.csproj
index ce4905f1d..10ca68581 100644
--- a/src/MsgPack.Silverlight.5/MsgPack.Silverlight.5.csproj
+++ b/src/MsgPack.Silverlight.5/MsgPack.Silverlight.5.csproj
@@ -446,6 +446,15 @@
Serialization\DefaultSerializers\System_VersionMessagePackSerializer.cs
+
+ Serialization\DefaultSerializers\TimestampDateTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializerProvider.cs
+
Serialization\DefaultSerializers\UnixEpocDateTimeMessagePackSerializer.cs
@@ -743,6 +752,42 @@
SubtreeUnpacker.Unpacking.cs
+
+ Timestamp.Calculation.cs
+
+
+ Timestamp.Comparison.cs
+
+
+ Timestamp.Conversion.cs
+
+
+ Timestamp.cs
+
+
+ Timestamp.ParseExact.cs
+
+
+ Timestamp.Properties.cs
+
+
+ Timestamp.ToString.cs
+
+
+ Timestamp.TryParseExact.cs
+
+
+ TimestampParseResult.cs
+
+
+ TimestampStringConverter.cs
+
+
+ TimestampStringConverter.Parse.cs
+
+
+ TimestampStringConverter.ToString.cs
+
TupleItems.cs
diff --git a/src/MsgPack.Silverlight.WindowsPhone/MsgPack.Silverlight.WindowsPhone.csproj b/src/MsgPack.Silverlight.WindowsPhone/MsgPack.Silverlight.WindowsPhone.csproj
index a1a010c92..dcd604b53 100644
--- a/src/MsgPack.Silverlight.WindowsPhone/MsgPack.Silverlight.WindowsPhone.csproj
+++ b/src/MsgPack.Silverlight.WindowsPhone/MsgPack.Silverlight.WindowsPhone.csproj
@@ -441,6 +441,18 @@
Serialization\DefaultSerializers\System_VersionMessagePackSerializer.cs
+
+ Serialization\DefaultSerializers\TimestampDateTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampFileTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializerProvider.cs
+
Serialization\DefaultSerializers\UnixEpocDateTimeMessagePackSerializer.cs
@@ -741,6 +753,42 @@
SubtreeUnpacker.Unpacking.cs
+
+ Timestamp.Calculation.cs
+
+
+ Timestamp.Comparison.cs
+
+
+ Timestamp.Conversion.cs
+
+
+ Timestamp.cs
+
+
+ Timestamp.ParseExact.cs
+
+
+ Timestamp.Properties.cs
+
+
+ Timestamp.ToString.cs
+
+
+ Timestamp.TryParseExact.cs
+
+
+ TimestampParseResult.cs
+
+
+ TimestampStringConverter.cs
+
+
+ TimestampStringConverter.Parse.cs
+
+
+ TimestampStringConverter.ToString.cs
+
TupleItems.cs
diff --git a/src/MsgPack.Unity.Full/MsgPack.Unity.Full.csproj b/src/MsgPack.Unity.Full/MsgPack.Unity.Full.csproj
index 866d3290e..f447a9044 100644
--- a/src/MsgPack.Unity.Full/MsgPack.Unity.Full.csproj
+++ b/src/MsgPack.Unity.Full/MsgPack.Unity.Full.csproj
@@ -418,6 +418,15 @@
Serialization\DefaultSerializers\System_VersionMessagePackSerializer.cs
+
+ Serialization\DefaultSerializers\TimestampDateTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializerProvider.cs
+
Serialization\DefaultSerializers\UnixEpocDateTimeMessagePackSerializer.cs
@@ -712,6 +721,42 @@
SubtreeUnpacker.Unpacking.cs
+
+ Timestamp.Calculation.cs
+
+
+ Timestamp.Comparison.cs
+
+
+ Timestamp.Conversion.cs
+
+
+ Timestamp.cs
+
+
+ Timestamp.ParseExact.cs
+
+
+ Timestamp.Properties.cs
+
+
+ Timestamp.ToString.cs
+
+
+ Timestamp.TryParseExact.cs
+
+
+ TimestampParseResult.cs
+
+
+ TimestampStringConverter.cs
+
+
+ TimestampStringConverter.Parse.cs
+
+
+ TimestampStringConverter.ToString.cs
+
TupleItems.cs
diff --git a/src/MsgPack.Unity/MsgPack.Unity.csproj b/src/MsgPack.Unity/MsgPack.Unity.csproj
index 9295d30b0..999754ed8 100644
--- a/src/MsgPack.Unity/MsgPack.Unity.csproj
+++ b/src/MsgPack.Unity/MsgPack.Unity.csproj
@@ -424,6 +424,15 @@
Serialization\DefaultSerializers\System_VersionMessagePackSerializer.cs
+
+ Serialization\DefaultSerializers\TimestampDateTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializerProvider.cs
+
Serialization\DefaultSerializers\UnixEpocDateTimeMessagePackSerializer.cs
@@ -718,6 +727,42 @@
SubtreeUnpacker.Unpacking.cs
+
+ Timestamp.Calculation.cs
+
+
+ Timestamp.Comparison.cs
+
+
+ Timestamp.Conversion.cs
+
+
+ Timestamp.cs
+
+
+ Timestamp.ParseExact.cs
+
+
+ Timestamp.Properties.cs
+
+
+ Timestamp.ToString.cs
+
+
+ Timestamp.TryParseExact.cs
+
+
+ TimestampParseResult.cs
+
+
+ TimestampStringConverter.cs
+
+
+ TimestampStringConverter.Parse.cs
+
+
+ TimestampStringConverter.ToString.cs
+
TupleItems.cs
diff --git a/src/MsgPack.Uwp/MsgPack.Uwp.csproj b/src/MsgPack.Uwp/MsgPack.Uwp.csproj
index 61f0a7247..df83e84ab 100644
--- a/src/MsgPack.Uwp/MsgPack.Uwp.csproj
+++ b/src/MsgPack.Uwp/MsgPack.Uwp.csproj
@@ -484,6 +484,18 @@
Serialization\DefaultSerializers\System_VersionMessagePackSerializer.cs
+
+ Serialization\DefaultSerializers\TimestampDateTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampFileTimeMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializer.cs
+
+
+ Serialization\DefaultSerializers\TimestampMessagePackSerializerProvider.cs
+
Serialization\DefaultSerializers\UnixEpocDateTimeMessagePackSerializer.cs
@@ -787,6 +799,42 @@
TaskAugument.cs
+
+ Timestamp.Calculation.cs
+
+
+ Timestamp.Comparison.cs
+
+
+ Timestamp.Conversion.cs
+
+
+ Timestamp.cs
+
+
+ Timestamp.ParseExact.cs
+
+
+ Timestamp.Properties.cs
+
+
+ Timestamp.ToString.cs
+
+
+ Timestamp.TryParseExact.cs
+
+
+ TimestampParseResult.cs
+
+
+ TimestampStringConverter.cs
+
+
+ TimestampStringConverter.Parse.cs
+
+
+ TimestampStringConverter.ToString.cs
+
TupleItems.cs
diff --git a/src/MsgPack/KnownExtTypeCode.cs b/src/MsgPack/KnownExtTypeCode.cs
index b5466e4cd..3724f8182 100644
--- a/src/MsgPack/KnownExtTypeCode.cs
+++ b/src/MsgPack/KnownExtTypeCode.cs
@@ -2,7 +2,7 @@
//
// MessagePack for CLI
//
-// Copyright (C) 2015 FUJIWARA, Yusuke
+// Copyright (C) 2015-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -31,6 +31,17 @@ namespace MsgPack
///
public static class KnownExtTypeCode
{
+ ///
+ /// Gets the ext type code which represents MsgPack timestamp.
+ ///
+ ///
+ /// 0xFF(-1).
+ ///
+ public static byte Timestamp
+ {
+ get { return 0xFF; }
+ }
+
///
/// Gets the ext type code which represents multidimensional array.
///
@@ -42,4 +53,4 @@ public static byte MultidimensionalArray
get { return 0x71; }
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/KnownExtTypeName.cs b/src/MsgPack/KnownExtTypeName.cs
index a14833950..629fef805 100644
--- a/src/MsgPack/KnownExtTypeName.cs
+++ b/src/MsgPack/KnownExtTypeName.cs
@@ -1,8 +1,8 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
-// Copyright (C) 2015 FUJIWARA, Yusuke
+// Copyright (C) 2015-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -31,6 +31,17 @@ namespace MsgPack
///
public static class KnownExtTypeName
{
+ ///
+ /// Gets the ext type name which represents MsgPack timestamp.
+ ///
+ ///
+ /// "Timestamp".
+ ///
+ public static string Timestamp
+ {
+ get { return "Timestamp"; }
+ }
+
///
/// Gets the ext type name which represents multidimensional array.
///
diff --git a/src/MsgPack/MessagePackByteArrayUnpacker.Unpack.cs b/src/MsgPack/MessagePackByteArrayUnpacker.Unpack.cs
index 56488b5a2..80678dbe4 100644
--- a/src/MsgPack/MessagePackByteArrayUnpacker.Unpack.cs
+++ b/src/MsgPack/MessagePackByteArrayUnpacker.Unpack.cs
@@ -3039,7 +3039,7 @@ private bool ReadMessagePackExtendedTypeObjectCore( int length, byte[] source, r
return false;
}
- result = new MessagePackExtendedTypeObject( typeCode, body );
+ result = MessagePackExtendedTypeObject.Unpack( typeCode, body );
return true;
}
diff --git a/src/MsgPack/MessagePackObject.Utilities.cs b/src/MsgPack/MessagePackObject.Utilities.cs
index 85d21c8a1..aff46751c 100644
--- a/src/MsgPack/MessagePackObject.Utilities.cs
+++ b/src/MsgPack/MessagePackObject.Utilities.cs
@@ -1,8 +1,8 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
-// Copyright (C) 2010-2016 FUJIWARA, Yusuke
+// Copyright (C) 2010-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -44,9 +44,9 @@
namespace MsgPack
{
-#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
+#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
[Serializable]
-#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
+#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
partial struct MessagePackObject : IPackable
#if FEATURE_TAP
, IAsyncPackable
@@ -1785,6 +1785,23 @@ public object ToObject()
}
}
+ ///
+ /// Gets a this object as a value.
+ ///
+ /// A value.
+ /// This object does not represent value.
+ public Timestamp AsTimestamp()
+ {
+ try
+ {
+ return Timestamp.Decode( this.AsMessagePackExtendedTypeObject() );
+ }
+ catch(ArgumentException ex)
+ {
+ throw new InvalidOperationException( ex.Message, ex );
+ }
+ }
+
#region -- Structure Operator Overloads --
///
diff --git a/src/MsgPack/MessagePackStreamUnpacker.Unpack.cs b/src/MsgPack/MessagePackStreamUnpacker.Unpack.cs
index 23f5e1e6a..4cf5c65c4 100644
--- a/src/MsgPack/MessagePackStreamUnpacker.Unpack.cs
+++ b/src/MsgPack/MessagePackStreamUnpacker.Unpack.cs
@@ -8089,7 +8089,7 @@ private bool ReadMessagePackExtendedTypeObjectCore( int length, byte[] buffer, r
return false;
}
- result = new MessagePackExtendedTypeObject( typeCode, body );
+ result = MessagePackExtendedTypeObject.Unpack( typeCode, body );
return true;
}
@@ -8427,7 +8427,7 @@ private async Task>();
}
- return AsyncReadResult.Success( new MessagePackExtendedTypeObject( typeCode, body ), offset );
+ return AsyncReadResult.Success( MessagePackExtendedTypeObject.Unpack( typeCode, body ), offset );
}
public sealed override async Task> ReadNullableMessagePackExtendedTypeObjectAsync( CancellationToken cancellationToken )
diff --git a/src/MsgPack/MessagePackString.cs b/src/MsgPack/MessagePackString.cs
index 7e1d038db..3b2113357 100644
--- a/src/MsgPack/MessagePackString.cs
+++ b/src/MsgPack/MessagePackString.cs
@@ -1,4 +1,4 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
@@ -43,9 +43,9 @@ namespace MsgPack
///
/// Encapselates and its serialized UTF-8 bytes.
///
-#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
+#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
[Serializable]
-#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
+#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
#if !NET35 && !UNITY
[SecuritySafeCritical]
#endif // !NET35 && !UNITY
diff --git a/src/MsgPack/MessagePackUnpackerCommon.Read.ttinclude b/src/MsgPack/MessagePackUnpackerCommon.Read.ttinclude
index c3fad269a..3a29d0d41 100644
--- a/src/MsgPack/MessagePackUnpackerCommon.Read.ttinclude
+++ b/src/MsgPack/MessagePackUnpackerCommon.Read.ttinclude
@@ -1,4 +1,4 @@
-<#@ import namespace="System.Collections.Generic" #>
+<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Globalization" #>
<#@ import namespace="System.Runtime.InteropServices" #><#+
//
@@ -618,14 +618,14 @@ private void WriteReadExt(
{
#>
- result = new MessagePackExtendedTypeObject( typeCode, body );
+ result = MessagePackExtendedTypeObject.Unpack( typeCode, body );
return true;
<#+
}
else
{
#>
- return AsyncReadResult.Success( new MessagePackExtendedTypeObject( typeCode, body ), <#= context.OffsetExpression #> );
+ return AsyncReadResult.Success( MessagePackExtendedTypeObject.Unpack( typeCode, body ), <#= context.OffsetExpression #> );
<#+
}
#>
@@ -1494,4 +1494,4 @@ private string ToPrimitive( Type type )
.Replace( "Boolean", "bool ")
.ToLowerInvariant();
}
-#>
\ No newline at end of file
+#>
diff --git a/src/MsgPack/MsgPack.csproj b/src/MsgPack/MsgPack.csproj
index fc6197cb3..0b015b48f 100644
--- a/src/MsgPack/MsgPack.csproj
+++ b/src/MsgPack/MsgPack.csproj
@@ -504,6 +504,7 @@
+
diff --git a/src/MsgPack/ReflectionAbstractions.cs b/src/MsgPack/ReflectionAbstractions.cs
index 1e68d209d..e606e5927 100644
--- a/src/MsgPack/ReflectionAbstractions.cs
+++ b/src/MsgPack/ReflectionAbstractions.cs
@@ -208,7 +208,7 @@ public static MethodInfo GetRuntimeMethod( this Type source, string name, Type[]
return
source.GetRuntimeMethods()
.SingleOrDefault(
- m => m.Name == name && m.GetParameters().Select( p => p.ParameterType ).SequenceEqual( parameters )
+ m => m.IsPublic && m.Name == name && m.GetParameters().Select( p => p.ParameterType ).SequenceEqual( parameters )
);
}
@@ -218,7 +218,7 @@ public static MethodInfo GetRuntimeMethod( this Type source, string name, Type[]
return
source.GetMethod(
name,
- BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic,
+ BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public,
null,
parameters,
null
@@ -280,7 +280,7 @@ public static Delegate CreateDelegate( this MethodInfo source, Type delegateType
#if NETSTANDARD1_1 || NETSTANDARD1_3
public static MethodInfo GetMethod( this Type source, string name )
{
- return source.GetRuntimeMethods().SingleOrDefault( m => m.Name == name && m.DeclaringType == source );
+ return source.GetRuntimeMethods().SingleOrDefault( m => m.IsPublic && m.Name == name && m.DeclaringType == source );
}
public static MethodInfo GetMethod( this Type source, string name, Type[] parameters )
diff --git a/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Collection.cs b/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Collection.cs
index e8a202683..f3fbb6b6a 100644
--- a/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Collection.cs
+++ b/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Collection.cs
@@ -1,4 +1,4 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
@@ -526,7 +526,7 @@ protected internal TConstruct EmitUnpackToInitialization( TContext context )
context.GetDeclaredField( FieldName.UnpackTo ),
this.EmitNewPrivateMethodDelegateExpression(
context,
- this.BaseClass.GetRuntimeMethod( MethodName.UnpackToCore, parameterTypes )
+ this.BaseClass.GetRuntimeMethods().Single( m => m.Name == MethodName.UnpackToCore && m.GetParameterTypes().SequenceEqual( parameterTypes ) )
)
);
@@ -542,7 +542,7 @@ protected internal TConstruct EmitUnpackToInitialization( TContext context )
context.GetDeclaredField( FieldName.UnpackTo + "Async" ),
this.EmitNewPrivateMethodDelegateExpression(
context,
- this.BaseClass.GetRuntimeMethod( MethodName.UnpackToAsyncCore, asyncParameterTypes )
+ this.BaseClass.GetRuntimeMethods().Single( m => m.Name == MethodName.UnpackToAsyncCore && m.GetParameterTypes().SequenceEqual( asyncParameterTypes ) )
)
);
diff --git a/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Nullable.cs b/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Nullable.cs
index d3d3eac95..6500885ff 100644
--- a/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Nullable.cs
+++ b/src/MsgPack/Serialization/AbstractSerializers/SerializerBuilder`2.Nullable.cs
@@ -1,4 +1,4 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
@@ -20,6 +20,9 @@
using System;
using System.Linq;
+#if FEATURE_TAP
+using System.Threading.Tasks;
+#endif // FEATURE_TAP
namespace MsgPack.Serialization.AbstractSerializers
{
@@ -77,7 +80,11 @@ private void BuildNullableUnpackFrom( TContext context, Type underlyingType, boo
#if FEATURE_TAP
isAsync ? MethodName.UnpackFromAsyncCore :
#endif // FEATURE_TAP
- MethodName.UnpackFromCore;
+ MethodName.UnpackFromCore;
+#if FEATURE_TAP
+ var asyncMethodReturnType = typeof( Task<> ).MakeGenericType( underlyingType );
+#endif // FEATURE_TAP
+
context.BeginMethodOverride( methodName );
var result = this.DeclareLocal( context, this.TargetType, "result" );
@@ -87,12 +94,15 @@ private void BuildNullableUnpackFrom( TContext context, Type underlyingType, boo
context,
this.EmitGetSerializerExpression( context, underlyingType, null, null ),
#if FEATURE_TAP
- isAsync ? typeof( MessagePackSerializer<> ).MakeGenericType( underlyingType ).GetMethod( "UnpackFromAsync", SerializerBuilderHelper.UnpackFromAsyncParameterTypes ) :
+ isAsync
+ ? typeof( MessagePackSerializer<> ).MakeGenericType( underlyingType ).GetMethods()
+ .Single( m => m.IsPublic && m.Name == "UnpackFromAsync" && m.ReturnType == asyncMethodReturnType && m.GetParameterTypes().SequenceEqual( SerializerBuilderHelper.UnpackFromAsyncParameterTypes ) ) :
#endif // FEATURE_TAP
typeof( MessagePackSerializer<> ).MakeGenericType( underlyingType ).GetMethod( "UnpackFrom" ),
context.Unpacker
);
+
context.EndMethodOverride(
methodName,
this.EmitRetrunStatement(
diff --git a/src/MsgPack/Serialization/CodeDomSerializers/CodeDomSerializerBuilder.cs b/src/MsgPack/Serialization/CodeDomSerializers/CodeDomSerializerBuilder.cs
index 3654d3949..7aa3f6aec 100644
--- a/src/MsgPack/Serialization/CodeDomSerializers/CodeDomSerializerBuilder.cs
+++ b/src/MsgPack/Serialization/CodeDomSerializers/CodeDomSerializerBuilder.cs
@@ -1425,7 +1425,10 @@ private void Finish( CodeDomContext context, SerializationTarget targetInfo, boo
context,
schema,
dependentSerializer.Key.PolymorphismSchema
- ).SelectMany( st => st.AsStatements() ).ToArray()
+ )
+ // inner ToArray() is required for .net core app 2.0 LINQ
+ .SelectMany( st => st.AsStatements().ToArray() )
+ .ToArray()
);
schemaExpression = new CodeVariableReferenceExpression( variableName );
diff --git a/src/MsgPack/Serialization/DateTimeConversionMethod.cs b/src/MsgPack/Serialization/DateTimeConversionMethod.cs
index 41c93c845..47e82fac8 100644
--- a/src/MsgPack/Serialization/DateTimeConversionMethod.cs
+++ b/src/MsgPack/Serialization/DateTimeConversionMethod.cs
@@ -31,7 +31,7 @@ public enum DateTimeConversionMethod
/// Uses context, that is, Gregorian 0000-01-01 based, 100 nano seconds resolution. This value also preserves .
///
///
- /// As of 0.6, this value has been become default. This option prevents accidental data loss.
+ /// As of 0.6 to 0.9, this value became default. This option prevents accidental data loss.
///
Native = 0,
@@ -39,8 +39,26 @@ public enum DateTimeConversionMethod
/// Uses Unix epoc context, that is, Gregirian 1970-01-01 based, milliseconds resolution.
///
///
- /// Many binding such as Java uses this resolution, so this option gives maximom interoperability.
+ /// Many binding such as Java uses this resolution, so this option gives maximum interoperability.
///
- UnixEpoc = 1
+ UnixEpoc = 1,
+
+ ///
+ /// Uses MsgPack timestamp format, that is, Gregirian 1970-01-01 based, nanoseconds resolution, with reserved ext type format.
+ ///
+ ///
+ ///
+ /// As of 1.0, this value became default.
+ ///
+ ///
+ /// This is best choice for interoperability and prevents accidental data loss, but old implementation does not recognize this type.
+ /// For backward compability purposes, use or instead.
+ ///
+ ///
+ /// Note that and cannot hold nanoseconds value.
+ /// If you can depend on this assembly, consider for date-time typed members to maximize interoperability for other languages.
+ ///
+ ///
+ Timestamp = 2
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DateTimeMemberConversionMethod.cs b/src/MsgPack/Serialization/DateTimeMemberConversionMethod.cs
index 5a0dce695..27dd26a69 100644
--- a/src/MsgPack/Serialization/DateTimeMemberConversionMethod.cs
+++ b/src/MsgPack/Serialization/DateTimeMemberConversionMethod.cs
@@ -49,6 +49,24 @@ public enum DateTimeMemberConversionMethod
///
/// Many binding such as Java uses this resolution, so this option gives maximom interoperability.
///
- UnixEpoc = 2
+ UnixEpoc = 2,
+
+ ///
+ /// Uses MsgPack timestamp format, that is, Gregirian 1970-01-01 based, nanoseconds resolution, with reserved ext type format.
+ ///
+ ///
+ ///
+ /// As of 1.0, this value became default.
+ ///
+ ///
+ /// This is best choice for interoperability and prevents accidental data loss, but old implementation does not recognize this type.
+ /// For backward compability purposes, use or instead.
+ ///
+ ///
+ /// Note that and cannot hold nanoseconds value.
+ /// If you can depend on this assembly, consider for date-time typed members to maximize interoperability for other languages.
+ ///
+ ///
+ Timestamp = 3
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DateTimeMessagePackSerializerHelpers.cs b/src/MsgPack/Serialization/DateTimeMessagePackSerializerHelpers.cs
index c64894444..e72b569e2 100644
--- a/src/MsgPack/Serialization/DateTimeMessagePackSerializerHelpers.cs
+++ b/src/MsgPack/Serialization/DateTimeMessagePackSerializerHelpers.cs
@@ -1,8 +1,8 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
-// Copyright (C) 2015 FUJIWARA, Yusuke
+// Copyright (C) 2015-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -73,6 +73,10 @@ DateTimeMemberConversionMethod dateTimeMemberConversionMethod
{
return DateTimeConversionMethod.UnixEpoc;
}
+ case DateTimeMemberConversionMethod.Timestamp:
+ {
+ return DateTimeConversionMethod.Timestamp;
+ }
default:
{
return context.DefaultDateTimeConversionMethod;
@@ -89,8 +93,9 @@ internal static bool IsDateTime( Type dateTimeType )
|| dateTimeType == typeof( FILETIME )
|| dateTimeType == typeof( FILETIME? )
#endif // ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY
- // DateTimeOffset? is not have to be treat specially.
- || dateTimeType == typeof( DateTimeOffset );
+ // DateTimeOffset? and Timestamp? do not have to be treat specially.
+ || dateTimeType == typeof( DateTimeOffset )
+ || dateTimeType == typeof( Timestamp );
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/DateTimeMessagePackSerializerProvider.cs b/src/MsgPack/Serialization/DefaultSerializers/DateTimeMessagePackSerializerProvider.cs
index dbcec5fa9..fa7f11779 100644
--- a/src/MsgPack/Serialization/DefaultSerializers/DateTimeMessagePackSerializerProvider.cs
+++ b/src/MsgPack/Serialization/DefaultSerializers/DateTimeMessagePackSerializerProvider.cs
@@ -2,7 +2,7 @@
//
// MessagePack for CLI
//
-// Copyright (C) 2015 FUJIWARA, Yusuke
+// Copyright (C) 2015-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ internal class DateTimeMessagePackSerializerProvider : MessagePackSerializerProv
{
private readonly MessagePackSerializer _unixEpoc;
private readonly MessagePackSerializer _native;
+ private readonly MessagePackSerializer _timestamp;
public DateTimeMessagePackSerializerProvider( SerializationContext context, bool isNullable )
{
@@ -44,17 +45,22 @@ public DateTimeMessagePackSerializerProvider( SerializationContext context, bool
new NullableMessagePackSerializer( context, new UnixEpocDateTimeMessagePackSerializer( context ) );
this._native =
new NullableMessagePackSerializer( context, new NativeDateTimeMessagePackSerializer( context ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, new TimestampDateTimeMessagePackSerializer( context ) );
#else
this._unixEpoc =
new NullableMessagePackSerializer( context, typeof( DateTime? ), new UnixEpocDateTimeMessagePackSerializer( context ) );
this._native =
new NullableMessagePackSerializer( context, typeof( DateTime? ), new NativeDateTimeMessagePackSerializer( context ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, typeof( DateTime? ), new TimestampDateTimeMessagePackSerializer( context ) );
#endif // !UNITY
}
else
{
this._unixEpoc = new UnixEpocDateTimeMessagePackSerializer( context );
this._native = new NativeDateTimeMessagePackSerializer( context );
+ this._timestamp = new TimestampDateTimeMessagePackSerializer( context );
}
}
@@ -72,6 +78,10 @@ public override object Get( SerializationContext context, object providerParamet
{
return this._unixEpoc;
}
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
}
}
@@ -85,6 +95,10 @@ public override object Get( SerializationContext context, object providerParamet
{
return this._unixEpoc;
}
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
default:
{
throw new NotSupportedException(
@@ -99,4 +113,4 @@ public override object Get( SerializationContext context, object providerParamet
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializer.cs b/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializer.cs
index c1c22a81e..f7c52b328 100644
--- a/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializer.cs
+++ b/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializer.cs
@@ -2,7 +2,7 @@
//
// MessagePack for CLI
//
-// Copyright (C) 2015-2016 FUJIWARA, Yusuke
+// Copyright (C) 2015-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -52,7 +52,11 @@ public DateTimeOffsetMessagePackSerializer( SerializationContext ownerContext, D
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
protected internal override void PackToCore( Packer packer, DateTimeOffset objectTree )
{
- if ( this._conversion == DateTimeConversionMethod.Native )
+ if ( this._conversion == DateTimeConversionMethod.Timestamp )
+ {
+ packer.Pack( Timestamp.FromDateTimeOffset( objectTree ).Encode() );
+ }
+ else if ( this._conversion == DateTimeConversionMethod.Native )
{
packer.PackArrayHeader( 2 );
packer.Pack( objectTree.DateTime.ToBinary() );
@@ -73,7 +77,11 @@ protected internal override void PackToCore( Packer packer, DateTimeOffset objec
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
protected internal override DateTimeOffset UnpackFromCore( Unpacker unpacker )
{
- if ( unpacker.IsArrayHeader )
+ if ( unpacker.LastReadData.IsTypeOf().GetValueOrDefault() )
+ {
+ return Timestamp.Decode( unpacker.LastReadData.DeserializeAsMessagePackExtendedTypeObject() ).ToDateTimeOffset();
+ }
+ else if ( unpacker.IsArrayHeader )
{
if ( UnpackHelpers.GetItemsCount( unpacker ) != 2 )
{
@@ -104,7 +112,11 @@ protected internal override DateTimeOffset UnpackFromCore( Unpacker unpacker )
protected internal override async Task PackToAsyncCore( Packer packer, DateTimeOffset objectTree, CancellationToken cancellationToken )
{
- if ( this._conversion == DateTimeConversionMethod.Native )
+ if ( this._conversion == DateTimeConversionMethod.Timestamp )
+ {
+ await packer.PackAsync( Timestamp.FromDateTimeOffset( objectTree ).Encode(), cancellationToken ).ConfigureAwait( false );
+ }
+ else if ( this._conversion == DateTimeConversionMethod.Native )
{
await packer.PackArrayHeaderAsync( 2, cancellationToken ).ConfigureAwait( false );
await packer.PackAsync( objectTree.DateTime.ToBinary(), cancellationToken ).ConfigureAwait( false );
@@ -141,4 +153,4 @@ protected internal override Task UnpackFromAsyncCore( Unpacker u
#endif // FEATURE_TAP
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializerProvider.cs b/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializerProvider.cs
index cdfddeaa7..f66b16b66 100644
--- a/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializerProvider.cs
+++ b/src/MsgPack/Serialization/DefaultSerializers/DateTimeOffsetMessagePackSerializerProvider.cs
@@ -1,8 +1,8 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
-// Copyright (C) 2015 FUJIWARA, Yusuke
+// Copyright (C) 2015-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ internal class DateTimeOffsetMessagePackSerializerProvider : MessagePackSerializ
{
private readonly MessagePackSerializer _unixEpoc;
private readonly MessagePackSerializer _native;
+ private readonly MessagePackSerializer _timestamp;
public DateTimeOffsetMessagePackSerializerProvider( SerializationContext context, bool isNullable )
{
@@ -44,17 +45,22 @@ public DateTimeOffsetMessagePackSerializerProvider( SerializationContext context
new NullableMessagePackSerializer( context, new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.UnixEpoc ) );
this._native =
new NullableMessagePackSerializer( context, new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.Native ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.Timestamp ) );
#else
this._unixEpoc =
new NullableMessagePackSerializer( context, typeof( DateTimeOffset? ), new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.UnixEpoc ) );
this._native =
new NullableMessagePackSerializer( context, typeof( DateTimeOffset? ), new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.Native ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, typeof( DateTimeOffset? ), new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.Timestamp ) );
#endif // !UNITY
}
else
{
this._unixEpoc = new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.UnixEpoc );
this._native = new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.Native );
+ this._timestamp = new DateTimeOffsetMessagePackSerializer( context, DateTimeConversionMethod.Timestamp );
}
}
@@ -72,6 +78,10 @@ public override object Get( SerializationContext context, object providerParamet
{
return this._unixEpoc;
}
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
}
}
@@ -85,6 +95,10 @@ public override object Get( SerializationContext context, object providerParamet
{
return this._unixEpoc;
}
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
default:
{
throw new NotSupportedException(
@@ -99,4 +113,4 @@ public override object Get( SerializationContext context, object providerParamet
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/FileTimeMessagePackSerializerProvider.cs b/src/MsgPack/Serialization/DefaultSerializers/FileTimeMessagePackSerializerProvider.cs
index 1ec3e36a3..f10869b3d 100644
--- a/src/MsgPack/Serialization/DefaultSerializers/FileTimeMessagePackSerializerProvider.cs
+++ b/src/MsgPack/Serialization/DefaultSerializers/FileTimeMessagePackSerializerProvider.cs
@@ -2,7 +2,7 @@
//
// MessagePack for CLI
//
-// Copyright (C) 2010-2014 FUJIWARA, Yusuke
+// Copyright (C) 2010-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ internal class FileTimeMessagePackSerializerProvider : MessagePackSerializerProv
{
private readonly MessagePackSerializer _unixEpoc;
private readonly MessagePackSerializer _native;
+ private readonly MessagePackSerializer _timestamp;
public FileTimeMessagePackSerializerProvider( SerializationContext context, bool isNullable )
{
@@ -45,17 +46,22 @@ public FileTimeMessagePackSerializerProvider( SerializationContext context, bool
new NullableMessagePackSerializer( context, new UnixEpocFileTimeMessagePackSerializer( context ) );
this._native =
new NullableMessagePackSerializer( context, new NativeFileTimeMessagePackSerializer( context ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, new TimestampFileTimeMessagePackSerializer( context ) );
#else
this._unixEpoc =
new NullableMessagePackSerializer( context, typeof( FILETIME? ), new UnixEpocFileTimeMessagePackSerializer( context ) );
this._native =
new NullableMessagePackSerializer( context, typeof( FILETIME? ), new NativeFileTimeMessagePackSerializer( context ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, typeof( FILETIME? ), new TimestampFileTimeMessagePackSerializer( context ) );
#endif // !UNITY
}
else
{
this._unixEpoc = new UnixEpocFileTimeMessagePackSerializer( context );
this._native = new NativeFileTimeMessagePackSerializer( context );
+ this._timestamp = new TimestampFileTimeMessagePackSerializer( context );
}
}
@@ -73,6 +79,10 @@ public override object Get( SerializationContext context, object providerParamet
{
return this._unixEpoc;
}
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
}
}
@@ -86,6 +96,10 @@ public override object Get( SerializationContext context, object providerParamet
{
return this._unixEpoc;
}
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
default:
{
throw new NotSupportedException(
@@ -100,4 +114,4 @@ public override object Get( SerializationContext context, object providerParamet
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/MessagePackObjectExtensions.cs b/src/MsgPack/Serialization/DefaultSerializers/MessagePackObjectExtensions.cs
index 3d153bf27..4336e25bf 100644
--- a/src/MsgPack/Serialization/DefaultSerializers/MessagePackObjectExtensions.cs
+++ b/src/MsgPack/Serialization/DefaultSerializers/MessagePackObjectExtensions.cs
@@ -1,4 +1,4 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
@@ -61,5 +61,23 @@ public static string DeserializeAsString( this MessagePackObject source )
throw new SerializationException( String.Format( CultureInfo.CurrentCulture, "The unpacked value is not expected type. {0}", ex.Message ), ex );
}
}
+
+ ///
+ /// Invokes in deserializaton manner.
+ ///
+ /// .
+ /// A deserialized value.
+ /// is not expected type.
+ public static MessagePackExtendedTypeObject DeserializeAsMessagePackExtendedTypeObject( this MessagePackObject source )
+ {
+ try
+ {
+ return source.AsMessagePackExtendedTypeObject();
+ }
+ catch ( InvalidOperationException ex )
+ {
+ throw new SerializationException( String.Format( CultureInfo.CurrentCulture, "The unpacked value is not expected type. {0}", ex.Message ), ex );
+ }
+ }
}
}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/TimestampDateTimeMessagePackSerializer.cs b/src/MsgPack/Serialization/DefaultSerializers/TimestampDateTimeMessagePackSerializer.cs
new file mode 100644
index 000000000..ada00df8a
--- /dev/null
+++ b/src/MsgPack/Serialization/DefaultSerializers/TimestampDateTimeMessagePackSerializer.cs
@@ -0,0 +1,75 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2017 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+#if FEATURE_TAP
+using System.Threading;
+using System.Threading.Tasks;
+#endif // FEATURE_TAP
+
+namespace MsgPack.Serialization.DefaultSerializers
+{
+ ///
+ /// serializer using timestamp representation.
+ ///
+ internal class TimestampDateTimeMessagePackSerializer : MessagePackSerializer
+ {
+ public TimestampDateTimeMessagePackSerializer( SerializationContext ownerContext ) : base( ownerContext, SerializerCapabilities.PackTo | SerializerCapabilities.UnpackFrom ) { }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override void PackToCore( Packer packer, DateTime objectTree )
+ {
+ packer.Pack( Timestamp.FromDateTime( objectTree ).Encode() );
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override DateTime UnpackFromCore( Unpacker unpacker )
+ {
+ return Timestamp.Decode( unpacker.LastReadData.DeserializeAsMessagePackExtendedTypeObject() ).ToDateTime();
+ }
+
+#if FEATURE_TAP
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override Task PackToAsyncCore( Packer packer, DateTime objectTree, CancellationToken cancellationToken )
+ {
+ return packer.PackAsync( Timestamp.FromDateTime( objectTree ).Encode(), cancellationToken );
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Transfers all catched exceptions." )]
+ protected internal override Task UnpackFromAsyncCore( Unpacker unpacker, CancellationToken cancellationToken )
+ {
+ var tcs = new TaskCompletionSource();
+ try
+ {
+ tcs.SetResult( this.UnpackFromCore( unpacker ) );
+ }
+ catch ( Exception ex )
+ {
+ tcs.SetException( ex );
+ }
+
+ return tcs.Task;
+ }
+
+#endif // FEATURE_TAP
+
+ }
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/TimestampFileTimeMessagePackSerializer.cs b/src/MsgPack/Serialization/DefaultSerializers/TimestampFileTimeMessagePackSerializer.cs
new file mode 100644
index 000000000..d538f1514
--- /dev/null
+++ b/src/MsgPack/Serialization/DefaultSerializers/TimestampFileTimeMessagePackSerializer.cs
@@ -0,0 +1,75 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2017 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+using System.Runtime.InteropServices.ComTypes;
+#if FEATURE_TAP
+using System.Threading;
+using System.Threading.Tasks;
+#endif // FEATURE_TAP
+
+namespace MsgPack.Serialization.DefaultSerializers
+{
+ ///
+ /// serializer using timestamp representation.
+ ///
+ internal sealed class TimestampFileTimeMessagePackSerializer : MessagePackSerializer
+ {
+ public TimestampFileTimeMessagePackSerializer( SerializationContext ownerContext ) : base( ownerContext, SerializerCapabilities.PackTo | SerializerCapabilities.UnpackFrom ) { }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override void PackToCore( Packer packer, FILETIME objectTree )
+ {
+ packer.Pack( Timestamp.FromDateTime( objectTree.ToDateTime() ).Encode() );
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override FILETIME UnpackFromCore( Unpacker unpacker )
+ {
+ return Timestamp.Decode( unpacker.LastReadData.DeserializeAsMessagePackExtendedTypeObject() ).ToDateTime().ToWin32FileTimeUtc();
+ }
+
+#if FEATURE_TAP
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override Task PackToAsyncCore( Packer packer, FILETIME objectTree, CancellationToken cancellationToken )
+ {
+ return packer.PackAsync( Timestamp.FromDateTime( objectTree.ToDateTime() ).Encode(), cancellationToken );
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Transfers all catched exceptions." )]
+ protected internal override Task UnpackFromAsyncCore( Unpacker unpacker, CancellationToken cancellationToken )
+ {
+ var tcs = new TaskCompletionSource();
+ try
+ {
+ tcs.SetResult( this.UnpackFromCore( unpacker ) );
+ }
+ catch ( Exception ex )
+ {
+ tcs.SetException( ex );
+ }
+
+ return tcs.Task;
+ }
+
+#endif // FEATURE_TAP
+ }
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/TimestampMessagePackSerializer.cs b/src/MsgPack/Serialization/DefaultSerializers/TimestampMessagePackSerializer.cs
new file mode 100644
index 000000000..6c896866c
--- /dev/null
+++ b/src/MsgPack/Serialization/DefaultSerializers/TimestampMessagePackSerializer.cs
@@ -0,0 +1,128 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2015-2016 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+#if UNITY_5 || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
+#define UNITY
+#endif
+
+using System;
+#if CORE_CLR || UNITY || NETSTANDARD1_1
+using Contract = MsgPack.MPContract;
+#else
+using System.Diagnostics.Contracts;
+#endif // CORE_CLR || UNITY || NETSTANDARD1_1
+#if FEATURE_TAP
+using System.Threading;
+using System.Threading.Tasks;
+#endif // FEATURE_TAP
+
+namespace MsgPack.Serialization.DefaultSerializers
+{
+ ///
+ /// serializer using Unix Epoc or native representation.
+ ///
+ internal class TimestampMessagePackSerializer : MessagePackSerializer
+ {
+ private readonly DateTimeConversionMethod _conversion;
+
+ public TimestampMessagePackSerializer( SerializationContext ownerContext, DateTimeConversionMethod conversion )
+ : base( ownerContext, SerializerCapabilities.PackTo | SerializerCapabilities.UnpackFrom )
+ {
+ this._conversion = conversion;
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override void PackToCore( Packer packer, Timestamp objectTree )
+ {
+ if ( this._conversion == DateTimeConversionMethod.Timestamp )
+ {
+ packer.Pack( objectTree.Encode() );
+ }
+ else if ( this._conversion == DateTimeConversionMethod.Native )
+ {
+ packer.Pack( objectTree.ToDateTime().ToBinary() );
+ }
+ else
+ {
+#if DEBUG
+ Contract.Assert( this._conversion == DateTimeConversionMethod.UnixEpoc );
+#endif // DEBUG
+ packer.Pack( MessagePackConvert.FromDateTimeOffset( objectTree.ToDateTimeOffset() ) );
+ }
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", MessageId = "0", Justification = "Validated by caller in base class" )]
+ protected internal override Timestamp UnpackFromCore( Unpacker unpacker )
+ {
+ if ( unpacker.LastReadData.IsTypeOf().GetValueOrDefault() )
+ {
+ return Timestamp.Decode( unpacker.LastReadData.AsMessagePackExtendedTypeObject() );
+ }
+ else if ( this._conversion == DateTimeConversionMethod.UnixEpoc )
+ {
+ return MessagePackConvert.ToDateTimeOffset( unpacker.LastReadData.DeserializeAsInt64() );
+ }
+ else
+ {
+ return new DateTimeOffset( DateTime.FromBinary( unpacker.LastReadData.DeserializeAsInt64() ), TimeSpan.Zero );
+ }
+ }
+
+#if FEATURE_TAP
+
+ protected internal override async Task PackToAsyncCore( Packer packer, Timestamp objectTree, CancellationToken cancellationToken )
+ {
+ if ( this._conversion == DateTimeConversionMethod.Timestamp )
+ {
+ await packer.PackAsync( objectTree.Encode(), cancellationToken ).ConfigureAwait( false );
+ }
+ else if ( this._conversion == DateTimeConversionMethod.Native )
+ {
+ await packer.PackAsync( objectTree.ToDateTime().ToBinary(), cancellationToken ).ConfigureAwait( false );
+ }
+ else
+ {
+#if DEBUG
+ Contract.Assert( this._conversion == DateTimeConversionMethod.UnixEpoc );
+#endif // DEBUG
+ await packer.PackAsync( MessagePackConvert.FromDateTimeOffset( objectTree.ToDateTimeOffset() ), cancellationToken ).ConfigureAwait( false );
+ }
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Transfers all catched exceptions." )]
+ protected internal override Task UnpackFromAsyncCore( Unpacker unpacker, CancellationToken cancellationToken )
+ {
+ var tcs = new TaskCompletionSource();
+ try
+ {
+ tcs.SetResult( this.UnpackFromCore( unpacker ) );
+ }
+ catch ( Exception ex )
+ {
+ tcs.SetException( ex );
+ }
+
+ return tcs.Task;
+ }
+
+#endif // FEATURE_TAP
+
+ }
+}
diff --git a/src/MsgPack/Serialization/DefaultSerializers/TimestampMessagePackSerializerProvider.cs b/src/MsgPack/Serialization/DefaultSerializers/TimestampMessagePackSerializerProvider.cs
new file mode 100644
index 000000000..13fa60997
--- /dev/null
+++ b/src/MsgPack/Serialization/DefaultSerializers/TimestampMessagePackSerializerProvider.cs
@@ -0,0 +1,116 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2017 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+#if UNITY_5 || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
+#define UNITY
+#endif
+
+using System;
+using System.Globalization;
+
+namespace MsgPack.Serialization.DefaultSerializers
+{
+ ///
+ /// Provides runtime selection ability for serialization.
+ ///
+ internal class TimestampMessagePackSerializerProvider : MessagePackSerializerProvider
+ {
+ private readonly MessagePackSerializer _unixEpoc;
+ private readonly MessagePackSerializer _native;
+ private readonly MessagePackSerializer _timestamp;
+
+ public TimestampMessagePackSerializerProvider( SerializationContext context, bool isNullable )
+ {
+ if ( isNullable )
+ {
+#if !UNITY
+ this._unixEpoc =
+ new NullableMessagePackSerializer( context, new TimestampMessagePackSerializer( context, DateTimeConversionMethod.UnixEpoc ) );
+ this._native =
+ new NullableMessagePackSerializer( context, new TimestampMessagePackSerializer( context, DateTimeConversionMethod.Native ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, new TimestampMessagePackSerializer( context, DateTimeConversionMethod.Timestamp ) );
+#else
+ this._unixEpoc =
+ new NullableMessagePackSerializer( context, typeof( Timestamp? ), new TimestampMessagePackSerializer( context, DateTimeConversionMethod.UnixEpoc ) );
+ this._native =
+ new NullableMessagePackSerializer( context, typeof( Timestamp? ), new TimestampMessagePackSerializer( context, DateTimeConversionMethod.Native ) );
+ this._timestamp =
+ new NullableMessagePackSerializer( context, typeof( Timestamp? ), new TimestampMessagePackSerializer( context, DateTimeConversionMethod.Timestamp ) );
+#endif // !UNITY
+ }
+ else
+ {
+ this._unixEpoc = new TimestampMessagePackSerializer( context, DateTimeConversionMethod.UnixEpoc );
+ this._native = new TimestampMessagePackSerializer( context, DateTimeConversionMethod.Native );
+ this._timestamp = new TimestampMessagePackSerializer( context, DateTimeConversionMethod.Timestamp );
+ }
+ }
+
+ public override object Get( SerializationContext context, object providerParameter )
+ {
+ if ( providerParameter is DateTimeConversionMethod )
+ {
+ switch ( ( DateTimeConversionMethod )providerParameter )
+ {
+ case DateTimeConversionMethod.Native:
+ {
+ return this._native;
+ }
+ case DateTimeConversionMethod.UnixEpoc:
+ {
+ return this._unixEpoc;
+ }
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
+ }
+ }
+
+ switch ( context.DefaultDateTimeConversionMethod )
+ {
+ case DateTimeConversionMethod.Native:
+ {
+ return this._native;
+ }
+ case DateTimeConversionMethod.UnixEpoc:
+ {
+ return this._unixEpoc;
+ }
+ case DateTimeConversionMethod.Timestamp:
+ {
+ return this._timestamp;
+ }
+ default:
+ {
+ throw new NotSupportedException(
+ String.Format(
+ CultureInfo.CurrentCulture,
+ "Unknown {0} value '{1:G}'({1:D})",
+ typeof( DateTimeConversionMethod ),
+ context.DefaultDateTimeConversionMethod
+ )
+ );
+ }
+ }
+ }
+ }
+}
diff --git a/src/MsgPack/Serialization/ExtTypeCodeMapping.cs b/src/MsgPack/Serialization/ExtTypeCodeMapping.cs
index 969faafe4..f8122efa3 100644
--- a/src/MsgPack/Serialization/ExtTypeCodeMapping.cs
+++ b/src/MsgPack/Serialization/ExtTypeCodeMapping.cs
@@ -89,6 +89,7 @@ internal ExtTypeCodeMapping()
this._syncRoot = new object();
this._index = new Dictionary( 2 );
this._types = new Dictionary( 2 );
+ this.AddInternal( KnownExtTypeName.Timestamp, KnownExtTypeCode.Timestamp );
this.Add( KnownExtTypeName.MultidimensionalArray, KnownExtTypeCode.MultidimensionalArray );
}
@@ -107,7 +108,11 @@ public bool Add( string name, byte typeCode )
{
ValidateName( name );
ValidateTypeCode( typeCode );
+ return this.AddInternal( name, typeCode );
+ }
+ private bool AddInternal( string name, byte typeCode )
+ {
lock ( this._syncRoot )
{
try
@@ -244,4 +249,4 @@ private static void ValidateTypeCode( byte typeCode )
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/MsgPack/Serialization/MessagePackSerializer.Factories.cs b/src/MsgPack/Serialization/MessagePackSerializer.Factories.cs
index d48a27df6..fcef43bb3 100644
--- a/src/MsgPack/Serialization/MessagePackSerializer.Factories.cs
+++ b/src/MsgPack/Serialization/MessagePackSerializer.Factories.cs
@@ -1,4 +1,4 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
@@ -26,13 +26,17 @@
#define AOT
#endif
-#if !AOT && !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
+#if !AOT && !SILVERLIGHT && !NETSTANDARD1_1
#define FEATURE_EMIT
-#endif // !AOT && !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
+#endif // !AOT && !SILVERLIGHT && !NETSTANDARD1_1
using System;
using System.IO;
using System.Globalization;
+#if AOT
+using System.Linq;
+using System.Reflection;
+#endif // AOT
using System.Runtime.Serialization;
using MsgPack.Serialization.DefaultSerializers;
@@ -49,7 +53,9 @@
#endif // CORE_CLR || UNITY || NETSTANDARD1_1
#if FEATURE_EMIT
using MsgPack.Serialization.AbstractSerializers;
+#if !NETSTANDARD1_3
using MsgPack.Serialization.CodeDomSerializers;
+#endif // !NETSTANDARD1_3
using MsgPack.Serialization.EmittingSerializers;
#endif // FEATURE_EMIT
@@ -252,6 +258,7 @@ internal static MessagePackSerializer CreateInternal( SerializationContext
ISerializerBuilder builder;
switch ( context.SerializerOptions.EmitterFlavor )
{
+#if !NETSTANDARD1_3
case EmitterFlavor.CodeDomBased:
{
#if DEBUG
@@ -268,10 +275,11 @@ internal static MessagePackSerializer CreateInternal( SerializationContext
builder = new CodeDomSerializerBuilder( typeof( T ), collectionTraits );
break;
-#else
+#else // DEBUG
throw new NotSupportedException();
-#endif
+#endif // DEBUG
}
+#endif // !NETSTANDARD1_3
case EmitterFlavor.FieldBased:
{
builder = new AssemblyBuilderSerializerBuilder( typeof( T ), collectionTraits );
@@ -533,9 +541,10 @@ public static MessagePackSerializer Get( Type targetType, SerializationContext c
#if AOT
private static readonly System.Reflection.MethodInfo CreateInternal_2 =
- typeof( MessagePackSerializer ).GetRuntimeMethod(
- "CreateInternal",
- new []{ typeof( SerializationContext ), typeof( PolymorphismSchema ) }
+ typeof( MessagePackSerializer ).GetRuntimeMethods()
+ .Single( m =>
+ m.Name == "CreateInternal"
+ && m.GetParameterTypes().SequenceEqual( new []{ typeof( SerializationContext ), typeof( PolymorphismSchema ) } )
);
internal static MessagePackSerializer CreateInternal( SerializationContext context, Type targetType, PolymorphismSchema schema )
@@ -666,6 +675,25 @@ public static MessagePackObject UnpackMessagePackObject( Stream stream )
return _singleTonMpoDeserializer.Unpack( stream );
}
+ ///
+ /// Directly deserialize specified MessagePack byte array as tree.
+ ///
+ /// The stream which contains deserializing data.
+ /// A which is root of the deserialized MessagePack object tree.
+ ///
+ /// is null.
+ ///
+ ///
+ /// This method is convinient wrapper for for .
+ ///
+ /// You cannot override this method behavior because this method uses private instead of default context which is able to be accessed via .
+ ///
+ ///
+ public static MessagePackObject UnpackMessagePackObject( byte[] buffer )
+ {
+ return _singleTonMpoDeserializer.UnpackSingleObject( buffer );
+ }
+
///
/// Try to prepare specified type for some AOT(Ahead-Of-Time) compilation environment.
/// If the type will be used in collection or dictionary, use and/or instead.
diff --git a/src/MsgPack/Serialization/SerializationContext.cs b/src/MsgPack/Serialization/SerializationContext.cs
index c06d65893..cb8047b1c 100644
--- a/src/MsgPack/Serialization/SerializationContext.cs
+++ b/src/MsgPack/Serialization/SerializationContext.cs
@@ -2,7 +2,7 @@
//
// MessagePack for CLI
//
-// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+// Copyright (C) 2010-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -313,7 +313,7 @@ public DefaultConcreteTypeRepository DefaultCollectionTypes
get { return this._defaultCollectionTypes; }
}
- private int _defaultDateTimeConversionMethod;
+ private int _defaultDateTimeConversionMethod = ( int )DateTimeConversionMethod.Timestamp;
///
/// Gets or sets the default conversion methods of built-in serializers.
@@ -336,6 +336,7 @@ public DateTimeConversionMethod DefaultDateTimeConversionMethod
{
case DateTimeConversionMethod.Native:
case DateTimeConversionMethod.UnixEpoc:
+ case DateTimeConversionMethod.Timestamp:
{
break;
}
diff --git a/src/MsgPack/Serialization/SerializerRepository.defaults.cs b/src/MsgPack/Serialization/SerializerRepository.defaults.cs
index 03064679a..d0582deaa 100644
--- a/src/MsgPack/Serialization/SerializerRepository.defaults.cs
+++ b/src/MsgPack/Serialization/SerializerRepository.defaults.cs
@@ -1,4 +1,4 @@
-#region -- License Terms --
+#region -- License Terms --
//
// MessagePack for CLI
//
@@ -45,7 +45,7 @@ namespace MsgPack.Serialization
// ReSharper disable RedundantNameQualifier
partial class SerializerRepository
{
- internal const int DefaultTableCapacity = 56;
+ internal const int DefaultTableCapacity = 58;
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "This API is naturally coupled with many types" )]
internal static Dictionary InitializeDefaultTable( SerializationContext ownerContext )
@@ -66,12 +66,14 @@ internal static Dictionary InitializeDefaultTable( Se
dictionary.Add( typeof( Byte[] ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.System_ByteArrayMessagePackSerializer( ownerContext ) );
dictionary.Add( typeof( DateTime ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeMessagePackSerializerProvider( ownerContext, false ) );
dictionary.Add( typeof( DateTimeOffset ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeOffsetMessagePackSerializerProvider( ownerContext, false ) );
+ dictionary.Add( typeof( Timestamp ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.TimestampMessagePackSerializerProvider( ownerContext, false ) );
#if ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
dictionary.Add( typeof( System.Runtime.InteropServices.ComTypes.FILETIME ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.FileTimeMessagePackSerializerProvider( ownerContext, false ) );
#endif // ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
// DateTime, DateTimeOffset, and FILETIME must have nullable providers.
dictionary.Add( typeof( DateTime? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeMessagePackSerializerProvider( ownerContext, true ) );
dictionary.Add( typeof( DateTimeOffset? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeOffsetMessagePackSerializerProvider( ownerContext, true ) );
+ dictionary.Add( typeof( Timestamp? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.TimestampMessagePackSerializerProvider( ownerContext, true ) );
#if ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
dictionary.Add( typeof( System.Runtime.InteropServices.ComTypes.FILETIME? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.FileTimeMessagePackSerializerProvider( ownerContext, true ) );
#endif // ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
diff --git a/src/MsgPack/Serialization/SerializerRepository.defaults.tt b/src/MsgPack/Serialization/SerializerRepository.defaults.tt
index adbc6460c..58884213b 100644
--- a/src/MsgPack/Serialization/SerializerRepository.defaults.tt
+++ b/src/MsgPack/Serialization/SerializerRepository.defaults.tt
@@ -1,8 +1,8 @@
-<#
+<#
//
// MessagePack for CLI
//
-// Copyright (C) 2010-2016 FUJIWARA, Yusuke
+// Copyright (C) 2010-2017 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -135,6 +135,20 @@ var excludes =
// .NET 4.6 Types -- comment out when you face T4Template problems
typeof( System.Diagnostics.Tracing.EventSourceOptions ),
typeof( System.Threading.AsyncLocalValueChangedArgs<> ),
+ // .NET 4.7 Types -- comment out when you face T4Template problems
+ typeof( System.Security.Cryptography.ECCurve ),
+ typeof( System.Security.Cryptography.ECParameters ),
+ typeof( System.Security.Cryptography.ECPoint ),
+ // ValueTuples -- should be supported via tuple support
+ typeof( System.ValueTuple ),
+ typeof( System.ValueTuple<> ),
+ typeof( System.ValueTuple<,> ),
+ typeof( System.ValueTuple<,,> ),
+ typeof( System.ValueTuple<,,,> ),
+ typeof( System.ValueTuple<,,,,> ),
+ typeof( System.ValueTuple<,,,,,> ),
+ typeof( System.ValueTuple<,,,,,,> ),
+ typeof( System.ValueTuple<,,,,,,,> ),
};
var structTypes =
typeof( object ).Assembly.GetTypes()
@@ -270,7 +284,7 @@ namespace MsgPack.Serialization
// ReSharper disable RedundantNameQualifier
partial class <#= typeName #>
{
- internal const int DefaultTableCapacity = <#= structTypes.Where( t => !t.IsEnum ).Count() + classTypes.Length + 19 #>;
+ internal const int DefaultTableCapacity = <#= structTypes.Where( t => !t.IsEnum ).Count() + classTypes.Length + 21 #>;
[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "This API is naturally coupled with many types" )]
internal static Dictionary InitializeDefaultTable( SerializationContext ownerContext )
@@ -291,12 +305,14 @@ namespace MsgPack.Serialization
dictionary.Add( typeof( Byte[] ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.<#= typeof( Byte ).FullName.Replace( Type.Delimiter, '_' ).Replace( '`', '_' ) #>ArrayMessagePackSerializer( ownerContext ) );
dictionary.Add( typeof( DateTime ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeMessagePackSerializerProvider( ownerContext, false ) );
dictionary.Add( typeof( DateTimeOffset ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeOffsetMessagePackSerializerProvider( ownerContext, false ) );
+ dictionary.Add( typeof( Timestamp ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.TimestampMessagePackSerializerProvider( ownerContext, false ) );
#if ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
dictionary.Add( typeof( System.Runtime.InteropServices.ComTypes.FILETIME ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.FileTimeMessagePackSerializerProvider( ownerContext, false ) );
#endif // ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
// DateTime, DateTimeOffset, and FILETIME must have nullable providers.
dictionary.Add( typeof( DateTime? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeMessagePackSerializerProvider( ownerContext, true ) );
dictionary.Add( typeof( DateTimeOffset? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.DateTimeOffsetMessagePackSerializerProvider( ownerContext, true ) );
+ dictionary.Add( typeof( Timestamp? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.TimestampMessagePackSerializerProvider( ownerContext, true ) );
#if ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
dictionary.Add( typeof( System.Runtime.InteropServices.ComTypes.FILETIME? ).TypeHandle, new MsgPack.Serialization.DefaultSerializers.FileTimeMessagePackSerializerProvider( ownerContext, true ) );
#endif // ( !SILVERLIGHT || WINDOWS_PHONE ) && !XAMARIN && !UNITY && !UNITY
@@ -583,4 +599,4 @@ private static string ToCSharpToken( Type type )
return buffer.ToString();
}
-#>
\ No newline at end of file
+#>
diff --git a/src/MsgPack/Timestamp.Calculation.cs b/src/MsgPack/Timestamp.Calculation.cs
new file mode 100644
index 000000000..7d4d95886
--- /dev/null
+++ b/src/MsgPack/Timestamp.Calculation.cs
@@ -0,0 +1,240 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+#if UNITY_5 || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
+#define UNITY
+#endif
+
+using System;
+#if CORE_CLR || UNITY || NETSTANDARD1_1
+using Contract = MsgPack.MPContract;
+#else
+using System.Diagnostics.Contracts;
+#endif // CORE_CLR || UNITY || NETSTANDARD1_1
+#if !NET35 && !UNITY
+#if !WINDOWS_PHONE
+#if !UNITY || MSGPACK_UNITY_FULL
+using System.Numerics;
+#endif // !WINDOWS_PHONE
+#endif // !UNITY || MSGPACK_UNITY_FULL
+#endif // !NET35 && !UNITY
+
+namespace MsgPack
+{
+ partial struct Timestamp
+ {
+#if !NET35 && !UNITY
+#if !WINDOWS_PHONE
+#if !UNITY || MSGPACK_UNITY_FULL
+ private static readonly BigInteger NanoToSecondsAsBigInteger = new BigInteger( 1000 * 1000 * 1000 );
+#endif // !WINDOWS_PHONE
+#endif // !UNITY || MSGPACK_UNITY_FULL
+#endif // !NET35 && !UNITY
+
+ ///
+ /// Adds a specified to this instance.
+ ///
+ /// A which represents offset. Note that this value can be negative.
+ /// The result .
+ ///
+ /// The result of calculation overflows or underflows .
+ ///
+ public Timestamp Add( TimeSpan offset )
+ {
+ long secondsOffset;
+ int nanosOffset;
+ FromOffsetTicks( offset.Ticks, out secondsOffset, out nanosOffset );
+ var seconds = checked( this.unixEpochSeconds + secondsOffset );
+ var nanos = this.nanoseconds + nanosOffset;
+ if ( nanos > MaxNanoSeconds )
+ {
+ checked
+ {
+ seconds++;
+ }
+ nanos -= ( MaxNanoSeconds + 1 );
+ }
+ else if ( nanos < 0 )
+ {
+ checked
+ {
+ seconds--;
+ }
+ nanos = ( MaxNanoSeconds + 1 ) + nanos;
+ }
+
+ return new Timestamp( seconds, unchecked(( int )nanos) );
+ }
+
+ ///
+ /// Subtracts a specified from this instance.
+ ///
+ /// A which represents offset. Note that this value can be negative.
+ /// The result .
+ ///
+ /// The result of calculation overflows or underflows .
+ ///
+ public Timestamp Subtract( TimeSpan offset )
+ {
+ return this.Add( -offset );
+ }
+
+#if !NET35 && !UNITY
+#if !WINDOWS_PHONE
+#if !UNITY || MSGPACK_UNITY_FULL
+
+ ///
+ /// Adds a specified nanoseconds represented as a from this instance.
+ ///
+ /// A which represents offset. Note that this value can be negative.
+ /// The result .
+ ///
+ /// The result of calculation overflows or underflows .
+ ///
+ public Timestamp Add( BigInteger offsetNanoseconds )
+ {
+ BigInteger nanosecondsOffset;
+ var secondsOffset = ( long )BigInteger.DivRem( offsetNanoseconds, NanoToSecondsAsBigInteger, out nanosecondsOffset );
+
+ var seconds = checked( this.unixEpochSeconds + secondsOffset );
+ var nanos = this.nanoseconds + unchecked( ( int )nanosecondsOffset );
+ if ( nanos > MaxNanoSeconds )
+ {
+ checked
+ {
+ seconds++;
+ }
+ nanos -= ( MaxNanoSeconds + 1 );
+ }
+ else if ( nanos < 0 )
+ {
+ checked
+ {
+ seconds--;
+ }
+ nanos = ( MaxNanoSeconds + 1 ) + nanos;
+ }
+
+ return new Timestamp( seconds, unchecked(( int )nanos) );
+ }
+
+ ///
+ /// Subtracts a specified nanoseconds represented as a from this instance.
+ ///
+ /// A which represents offset. Note that this value can be negative.
+ /// The result .
+ ///
+ /// The result of calculation overflows or underflows .
+ ///
+ public Timestamp Subtract( BigInteger offsetNanoseconds )
+ {
+ return this.Add( -offsetNanoseconds );
+ }
+
+ ///
+ /// Calculates a difference this instance and a specified in nanoseconds.
+ ///
+ /// A to be differentiated.
+ /// A which represents difference in nanoseconds.
+ public BigInteger Subtract( Timestamp other )
+ {
+ var seconds = new BigInteger( this.unixEpochSeconds ) - other.unixEpochSeconds;
+ var nanos = ( long )this.nanoseconds - other.nanoseconds;
+#if DEBUG
+ Contract.Assert( nanos <= MaxNanoSeconds, nanos + " <= MaxNanoSeconds" );
+#endif // DEBUG
+ if ( nanos < 0 )
+ {
+ // move down
+ seconds--;
+ nanos = ( MaxNanoSeconds + 1 ) + nanos;
+ }
+
+ return seconds * SecondsToNanos + nanos;
+ }
+
+#endif // !WINDOWS_PHONE
+#endif // !UNITY || MSGPACK_UNITY_FULL
+#endif // !NET35 && !UNITY
+
+ ///
+ /// Calculates a with specified and an offset represented as .
+ ///
+ /// A .
+ /// An offset in . This value can be negative.
+ /// A .
+ public static Timestamp operator +( Timestamp value, TimeSpan offset )
+ {
+ return value.Add( offset );
+ }
+
+ ///
+ /// Calculates a with specified and an offset represented as .
+ ///
+ /// A .
+ /// An offset in . This value can be negative.
+ /// A .
+ public static Timestamp operator -( Timestamp value, TimeSpan offset )
+ {
+ return value.Subtract( offset );
+ }
+
+#if !NET35 && !UNITY
+#if !WINDOWS_PHONE
+#if !UNITY || MSGPACK_UNITY_FULL
+
+ ///
+ /// Calculates a with specified and a nanoseconds offset represented as .
+ ///
+ /// A .
+ /// An offset in nanoseconds as . This value can be negative.
+ /// A .
+ public static Timestamp operator +( Timestamp value, BigInteger offsetNanoseconds )
+ {
+ return value.Add( offsetNanoseconds );
+ }
+
+ ///
+ /// Calculates a with specified and a nanoseconds represented as .
+ ///
+ /// A .
+ /// An offset in nanoseconds as . This value can be negative.
+ /// A .
+ public static Timestamp operator -( Timestamp value, BigInteger offsetNanoseconds )
+ {
+ return value.Subtract( offsetNanoseconds );
+ }
+
+ ///
+ /// Calculates a difference between specified two s in nanoseconds.
+ ///
+ /// A .
+ /// A .
+ /// A which represents difference in nanoseconds.
+ public static BigInteger operator -( Timestamp left, Timestamp right )
+ {
+ return left.Subtract( right );
+ }
+
+#endif // !WINDOWS_PHONE
+#endif // !UNITY || MSGPACK_UNITY_FULL
+#endif // !NET35 && !UNITY
+ }
+}
diff --git a/src/MsgPack/Timestamp.Comparison.cs b/src/MsgPack/Timestamp.Comparison.cs
new file mode 100644
index 000000000..79e9f0304
--- /dev/null
+++ b/src/MsgPack/Timestamp.Comparison.cs
@@ -0,0 +1,213 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+
+namespace MsgPack
+{
+ partial struct Timestamp : IComparable, IEquatable , IComparable
+ {
+ ///
+ /// Compares this instance to the specified .
+ ///
+ /// A to be compared.
+ ///
+ /// If this instance is greater than the , then 1.
+ /// If this instance is less than the , then -1.
+ /// Else, this instance is equal to the , then 0.
+ ///
+ public int CompareTo( Timestamp other )
+ {
+ var result = this.unixEpochSeconds.CompareTo( other.unixEpochSeconds );
+ if ( result != 0 )
+ {
+ return result;
+ }
+
+ return this.nanoseconds.CompareTo( other.nanoseconds );
+ }
+
+ ///
+ /// Compares two instances.
+ ///
+ /// A to be compared.
+ /// A to be compared.
+ ///
+ /// If the is greater than the , then 1.
+ /// If the is less than the , then -1.
+ /// Else, the is equal to the , then 0.
+ ///
+ public static int Compare( Timestamp left, Timestamp right )
+ {
+ return left.CompareTo( right );
+ }
+
+ ///
+ /// Compares this instance to the specified object.
+ ///
+ /// An to be compared.
+ ///
+ /// If this instance is greater than the or the is null, then 1.
+ /// If this instance is less than the , then -1.
+ /// Else, this instance is equal to the , then 0.
+ ///
+ ///
+ /// is not a boxed .
+ ///
+ int IComparable.CompareTo( object obj )
+ {
+ if ( obj == null )
+ {
+ return 1;
+ }
+
+ if ( !( obj is Timestamp ) )
+ {
+ throw new ArgumentException( "obj is not MsgPack.Timestamp object.", "obj" );
+ }
+
+ return this.CompareTo( ( Timestamp )obj );
+ }
+
+ ///
+ /// Determines the specified is equal to this instance.
+ ///
+ /// An to be compared.
+ ///
+ /// true, if the is boxed and its value is equal to this instance;
+ /// otherwise, false.
+ ///
+ public override bool Equals( object obj )
+ {
+ if ( !( obj is Timestamp ) )
+ {
+ return false;
+ }
+
+ return this.Equals( ( Timestamp )obj );
+ }
+
+ ///
+ /// Determines the specified is equal to this instance.
+ ///
+ /// A to be compared.
+ ///
+ /// true, if the is equal to this instance;
+ /// otherwise, false.
+ ///
+ public bool Equals( Timestamp other )
+ {
+ return this.unixEpochSeconds == other.unixEpochSeconds && this.nanoseconds == other.nanoseconds;
+ }
+
+ ///
+ /// Gets a hash code of this instance.
+ ///
+ /// A hash code of this instance.
+ public override int GetHashCode()
+ {
+ return this.unixEpochSeconds.GetHashCode() ^ this.nanoseconds.GetHashCode();
+ }
+
+ ///
+ /// Determines the is greater than the .
+ ///
+ /// A .
+ /// A .
+ ///
+ /// true, if is greater than the ;
+ /// Otherwise, false.
+ ///
+ public static bool operator >( Timestamp left, Timestamp right )
+ {
+ return left.CompareTo( right ) > 0;
+ }
+
+ ///
+ /// Determines the is less than the .
+ ///
+ /// A .
+ /// A .
+ ///
+ /// true, if is less than the ;
+ /// Otherwise, false.
+ ///
+ public static bool operator <( Timestamp left, Timestamp right )
+ {
+ return left.CompareTo( right ) < 0;
+ }
+
+ ///
+ /// Determines the is greater than or equal to the .
+ ///
+ /// A .
+ /// A .
+ ///
+ /// true, if is greater than or equal to the ;
+ /// Otherwise, false.
+ ///
+ public static bool operator >=( Timestamp left, Timestamp right )
+ {
+ return left.CompareTo( right ) >= 0;
+ }
+
+ ///
+ /// Determines the is less than or equal to the .
+ ///
+ /// A .
+ /// A .
+ ///
+ /// true, if is less than or equal to the ;
+ /// Otherwise, false.
+ ///
+ public static bool operator <=( Timestamp left, Timestamp right )
+ {
+ return left.CompareTo( right ) <= 0;
+ }
+
+ ///
+ /// Determines two instances are equal.
+ ///
+ /// A .
+ /// A .
+ ///
+ /// true, if is equal to ;
+ /// Otherwise, false.
+ ///
+ public static bool operator ==( Timestamp left, Timestamp right )
+ {
+ return left.Equals( right );
+ }
+
+ ///
+ /// Determines two instances are not equal.
+ ///
+ /// A .
+ /// A .
+ ///
+ /// true, if is not equal to ;
+ /// Otherwise, false.
+ ///
+ public static bool operator !=( Timestamp left, Timestamp right )
+ {
+ return !left.Equals( right );
+ }
+ }
+}
diff --git a/src/MsgPack/Timestamp.Conversion.cs b/src/MsgPack/Timestamp.Conversion.cs
new file mode 100644
index 000000000..8de883e09
--- /dev/null
+++ b/src/MsgPack/Timestamp.Conversion.cs
@@ -0,0 +1,289 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+using System.Globalization;
+
+namespace MsgPack
+{
+ partial struct Timestamp
+ {
+ private long ToTicks( Type destination )
+ {
+ if ( this.unixEpochSeconds < MinUnixEpochSecondsForTicks )
+ {
+ throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "This value is too small for '{0}'.", destination ) );
+ }
+
+ if ( this.unixEpochSeconds > MaxUnixEpochSecondsForTicks )
+ {
+ throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "This value is too large for '{0}'.", destination ) );
+ }
+
+ return ( UnixEpochInSeconds + this.unixEpochSeconds ) * SecondsToTicks + this.nanoseconds / NanoToTicks;
+ }
+
+ ///
+ /// Converts this instance to equivalant instance with .
+ ///
+ /// An equivalant instance with .
+ ///
+ /// This instance represents before or after .
+ ///
+ public DateTime ToDateTime()
+ {
+ return new DateTime( this.ToTicks( typeof( DateTime ) ), DateTimeKind.Utc );
+ }
+
+ ///
+ /// Converts this instance to equivalant instance with offset 0.
+ ///
+ /// An equivalant instance with offset 0
+ ///
+ /// This instance represents before or after .
+ ///
+ public DateTimeOffset ToDateTimeOffset()
+ {
+ return new DateTimeOffset( this.ToTicks( typeof( DateTimeOffset ) ), TimeSpan.Zero );
+ }
+
+ ///
+ /// Encodes this instance to a .
+ ///
+ /// A which equivalant to this instance.
+ public MessagePackExtendedTypeObject Encode()
+ {
+ if ( ( this.unixEpochSeconds >> 34 ) != 0 )
+ {
+ // timestamp 96
+ var value = this;
+ var body = new byte[ 12 ];
+ body[ 0 ] = unchecked( ( byte )( ( this.nanoseconds >> 24 ) & 0xFF ) );
+ body[ 1 ] = unchecked( ( byte )( ( this.nanoseconds >> 16 ) & 0xFF ) );
+ body[ 2 ] = unchecked( ( byte )( ( this.nanoseconds >> 8 ) & 0xFF ) );
+ body[ 3 ] = unchecked( ( byte )( ( this.nanoseconds ) & 0xFF ) );
+ body[ 4 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 56 ) & 0xFF ) );
+ body[ 5 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 48 ) & 0xFF ) );
+ body[ 6 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 40 ) & 0xFF ) );
+ body[ 7 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 32 ) & 0xFF ) );
+ body[ 8 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 24 ) & 0xFF ) );
+ body[ 9 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 16 ) & 0xFF ) );
+ body[ 10 ] = unchecked( ( byte )( ( this.unixEpochSeconds >> 8 ) & 0xFF ) );
+ body[ 11 ] = unchecked( ( byte )( this.unixEpochSeconds & 0xFF ) );
+
+ return MessagePackExtendedTypeObject.Unpack( TypeCode, body );
+ }
+ else
+ {
+ var encoded = ( ( ( ulong )this.nanoseconds ) << 34 ) | unchecked( ( ulong )this.unixEpochSeconds );
+ if ( ( encoded & 0xFFFFFFFF00000000L ) == 0 )
+ {
+ // timestamp 32
+ var value = unchecked( ( uint )encoded );
+ var body = new byte[ 4 ];
+ body[ 0 ] = unchecked( ( byte )( ( encoded >> 24 ) & 0xFF ) );
+ body[ 1 ] = unchecked( ( byte )( ( encoded >> 16 ) & 0xFF ) );
+ body[ 2 ] = unchecked( ( byte )( ( encoded >> 8 ) & 0xFF ) );
+ body[ 3 ] = unchecked( ( byte )( encoded & 0xFF ) );
+
+ return MessagePackExtendedTypeObject.Unpack( TypeCode, body );
+ }
+ else
+ {
+ // timestamp 64
+ var body = new byte[ 8 ];
+ body[ 0 ] = unchecked( ( byte )( ( encoded >> 56 ) & 0xFF ) );
+ body[ 1 ] = unchecked( ( byte )( ( encoded >> 48 ) & 0xFF ) );
+ body[ 2 ] = unchecked( ( byte )( ( encoded >> 40 ) & 0xFF ) );
+ body[ 3 ] = unchecked( ( byte )( ( encoded >> 32 ) & 0xFF ) );
+ body[ 4 ] = unchecked( ( byte )( ( encoded >> 24 ) & 0xFF ) );
+ body[ 5 ] = unchecked( ( byte )( ( encoded >> 16 ) & 0xFF ) );
+ body[ 6 ] = unchecked( ( byte )( ( encoded >> 8 ) & 0xFF ) );
+ body[ 7 ] = unchecked( ( byte )( encoded & 0xFF ) );
+
+ return MessagePackExtendedTypeObject.Unpack( TypeCode, body );
+ }
+ }
+ }
+
+ private static void FromDateTimeTicks( long ticks, out long unixEpocSeconds, out int nanoSeconds )
+ {
+ FromOffsetTicks( ticks - UnixEpochTicks, out unixEpocSeconds, out nanoSeconds );
+ }
+
+ private static void FromOffsetTicks( long ticks, out long unixEpocSeconds, out int nanoSeconds )
+ {
+ long remaining;
+ unixEpocSeconds = DivRem( ticks, SecondsToTicks, out remaining );
+ nanoSeconds = unchecked( ( int )remaining ) * 100;
+ }
+
+ ///
+ /// Gets an equivalant to specified .
+ ///
+ /// A .
+ /// An equivalant to specified
+ public static Timestamp FromDateTime( DateTime value )
+ {
+ long unixEpocSeconds;
+ int nanoSeconds;
+ FromDateTimeTicks( ( value.Kind == DateTimeKind.Local ? value.ToUniversalTime() : value ).Ticks, out unixEpocSeconds, out nanoSeconds );
+ return new Timestamp( unixEpocSeconds, nanoSeconds );
+ }
+
+ ///
+ /// Gets an equivalant to specified .
+ ///
+ /// A .
+ /// An equivalant to specified
+ public static Timestamp FromDateTimeOffset( DateTimeOffset value )
+ {
+ long unixEpocSeconds;
+ int nanoSeconds;
+ FromDateTimeTicks( value.UtcTicks, out unixEpocSeconds, out nanoSeconds );
+ return new Timestamp( unixEpocSeconds, nanoSeconds );
+ }
+
+ ///
+ /// Decodes specified and returns an equivalant .
+ ///
+ /// which is native representation of .
+ /// .
+ ///
+ /// does not represent msgpack timestamp. Specifically, the type code is not equal to value.
+ /// Or, does not have valid msgpack timestamp structure.
+ ///
+ ///
+ /// have invalid nanoseconds value.
+ ///
+ ///
+ /// A definition of valid msgpack time stamp is:
+ ///
+ /// - Its type code is 0xFF(-1).
+ /// - Its length is 4, 8, or 12 bytes.
+ /// - Its nanoseconds part is between 0 and 999,999,999.
+ ///
+ ///
+ public static Timestamp Decode( MessagePackExtendedTypeObject value )
+ {
+ if ( value.TypeCode != TypeCode )
+ {
+ throw new ArgumentException( "The value's type code must be 0xFF.", "value" );
+ }
+
+ switch( value.Body.Length )
+ {
+ case 4:
+ {
+ // timespan32 format
+ return new Timestamp( BigEndianBinary.ToUInt32( value.Body, 0 ), 0 );
+ }
+ case 8:
+ {
+ // timespan64 format
+ var payload = BigEndianBinary.ToUInt64( value.Body, 0 );
+ return new Timestamp( unchecked( ( long )( payload & 0x00000003ffffffffL ) ), unchecked( ( int )( payload >> 34 ) ) );
+ }
+ case 12:
+ {
+ // timespan96 format
+ return new Timestamp( BigEndianBinary.ToInt64( value.Body, sizeof( int ) ), unchecked( ( int )BigEndianBinary.ToUInt32( value.Body, 0 ) ) );
+ }
+ default:
+ {
+ throw new ArgumentException( "The value's length is not valid.", "value" );
+ }
+ }
+ }
+
+ ///
+ /// Converts a value to a value with .
+ ///
+ /// A .
+ /// A with .
+ ///
+ /// This instance represents before or after .
+ ///
+ public static explicit operator DateTime( Timestamp value )
+ {
+ return value.ToDateTime();
+ }
+
+ ///
+ /// Converts a value to a value with offset 0.
+ ///
+ /// A .
+ /// A value with offset 0.
+ ///
+ /// This instance represents before or after .
+ ///
+ public static explicit operator DateTimeOffset( Timestamp value )
+ {
+ return value.ToDateTimeOffset();
+ }
+
+ ///
+ /// Converts a value to a .
+ ///
+ /// A .
+ /// A .
+ public static implicit operator MessagePackExtendedTypeObject( Timestamp value )
+ {
+ return value.Encode();
+ }
+
+ ///
+ /// Converts a value to a .
+ ///
+ /// A .
+ /// A .
+ public static implicit operator Timestamp( DateTime value )
+ {
+ return FromDateTime( value );
+ }
+
+ ///
+ /// Converts a value to a .
+ ///
+ /// A .
+ /// A .
+ public static implicit operator Timestamp( DateTimeOffset value )
+ {
+ return FromDateTimeOffset( value );
+ }
+
+ ///
+ /// Converts a value to a .
+ ///
+ /// A .
+ /// A .
+ ///
+ /// does not represent msgpack timestamp. Specifically, the type code is not equal to value.
+ /// Or, does not have valid msgpack timestamp structure.
+ ///
+ ///
+ /// have invalid nanoseconds value.
+ ///
+ public static explicit operator Timestamp( MessagePackExtendedTypeObject value )
+ {
+ return Decode( value );
+ }
+ }
+}
diff --git a/src/MsgPack/Timestamp.ParseExact.cs b/src/MsgPack/Timestamp.ParseExact.cs
new file mode 100644
index 000000000..43533b8a9
--- /dev/null
+++ b/src/MsgPack/Timestamp.ParseExact.cs
@@ -0,0 +1,324 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+#if UNITY_5 || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
+#define UNITY
+#endif
+
+using System;
+#if CORE_CLR || UNITY || NETSTANDARD1_1
+using Contract = MsgPack.MPContract;
+#else
+using System.Diagnostics.Contracts;
+#endif // CORE_CLR || UNITY || NETSTANDARD1_1
+using System.Globalization;
+
+namespace MsgPack
+{
+ partial struct Timestamp
+ {
+ ///
+ /// Converts specified representation of a msgpack timestamp to its equivalant
+ /// with specified format and culture-specific format information provider.
+ ///
+ /// An input representation of a msgpack timestamp. The format must be match exactly to the .
+ /// An expected format string.
+ /// An to provide culture specific information to parse .
+ /// The converted .
+ ///
+ ///
+ /// Currently, supported date-time format is only 'o' and 'O' (round-trip) or 's' (sortable, ISO-8601).
+ /// Other any standard date-time formats and custom date-time formats are not supported.
+ ///
+ ///
+ /// The rount-trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff which "fffffffff" is nanoseconds.
+ ///
+ ///
+ /// The sign mark can be culture-specific, and leading/trailing whitespaces can be allowed when specify appropriate .
+ ///
+ ///
+ ///
+ /// is null.
+ /// Or, is null.
+ ///
+ ///
+ /// The specified is not supported.
+ ///
+ ///
+ /// The specified is not valid for the specified and .
+ ///
+ public static Timestamp ParseExact( string input, string format, IFormatProvider formatProvider )
+ {
+ return ParseExact( input, format, formatProvider, DateTimeStyles.None );
+ }
+
+ ///
+ /// Converts specified representation of a msgpack timestamp to its equivalant
+ /// with specified format, culture-specific format information provider, and .
+ ///
+ /// An input representation of a msgpack timestamp. The format must be match exactly to the .
+ /// An expected format string.
+ /// An to provide culture specific information to parse .
+ ///
+ /// Specify bitwise value combination of to control detailed parsing behavior.
+ /// The typical value is .
+ ///
+ /// The converted .
+ ///
+ ///
+ /// Currently, supported date-time format is only 'o' and 'O' (round-trip) or 's' (sortable, ISO-8601).
+ /// Other any standard date-time formats and custom date-time formats are not supported.
+ ///
+ ///
+ /// The rount-trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff which "fffffffff" is nanoseconds.
+ ///
+ ///
+ /// The sign mark can be culture-specific, and leading/trailing whitespaces can be allowed when specify appropriate .
+ ///
+ ///
+ ///
+ /// is null.
+ /// Or, is null.
+ ///
+ ///
+ /// The specified is not supported.
+ /// Or the specified has invalid combination.
+ ///
+ ///
+ /// The specified is not valid for the specified , , and .
+ ///
+ public static Timestamp ParseExact( string input, string format, IFormatProvider formatProvider, DateTimeStyles styles )
+ {
+ Timestamp result;
+ HandleParseResult( TryParseExactCore( input, format, formatProvider, styles, out result ), "Cannot parse specified input with specified format." );
+ return result;
+ }
+
+ ///
+ /// Converts specified representation of a msgpack timestamp to its equivalant
+ /// with specified format, culture-specific format information provider, and .
+ ///
+ /// The input representation of a msgpack timestamp. The format must be match exactly to one of the .
+ /// The array of expected format strings. Unsupported format will be ignored.
+ /// The culture specific information to control
+ ///
+ /// Specify bitwise value combination of to control detailed parsing behavior.
+ /// The typical value is .
+ ///
+ /// The converted .
+ ///
+ ///
+ /// Currently, supported date-time format is only 'o' and 'O' (round-trip) or 's' (sortable, ISO-8601).
+ /// Other any standard date-time formats and custom date-time formats are not supported.
+ ///
+ ///
+ /// The rount-trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff which "fffffffff" is nanoseconds.
+ ///
+ ///
+ /// The sign mark can be culture-specific, and leading/trailing whitespaces can be allowed when specify appropriate .
+ ///
+ ///
+ ///
+ /// is null.
+ /// Or, is null.
+ ///
+ ///
+ /// The specified is empty.
+ /// Or the specified has invalid combination.
+ ///
+ ///
+ /// The specified is not valid for any specified , , and .
+ ///
+ public static Timestamp ParseExact( string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles )
+ {
+ Timestamp result;
+ HandleParseResult( TryParseExactCore( input, formats, formatProvider, styles, out result ), "Cannot parse specified input with any specified formats." );
+ return result;
+ }
+
+ private static void HandleParseResult( TimestampParseResult result, string messageForInvalidInput )
+ {
+ if ( result == TimestampParseResult.Success )
+ {
+ return;
+ }
+
+ string parameterName;
+ string message;
+
+ var parameter = result & TimestampParseResult.ParameterMask;
+ switch( parameter )
+ {
+ case TimestampParseResult.ParameterFormat:
+ {
+ parameterName = "format";
+ break;
+ }
+ default:
+ {
+ Contract.Assert( parameter == TimestampParseResult.ParameterInput, parameter + " == TimestampParseResult.Input" );
+ parameterName = "input";
+ break;
+ }
+ }
+
+ var kind = result & TimestampParseResult.KindMask;
+
+ switch ( kind )
+ {
+ case TimestampParseResult.KindEmpty:
+ {
+ message = String.Format( CultureInfo.CurrentCulture, "'{0}' must not be empty.", parameterName );
+ break;
+ }
+ case TimestampParseResult.KindExtraCharactors:
+ {
+ message = "The input contains extra charactors.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidDateTimeDelimiter:
+ {
+ message = "A date-time delimiter of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidDay:
+ {
+ message = "Format of the day portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidHour:
+ {
+ message = "Format of the hour portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidHourMinuteDelimiter:
+ {
+ message = "A hour-miniute delimiter of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidMinute:
+ {
+ message = "Format of the minute portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidMinuteSecondDelimiter:
+ {
+ message = "A miniute-second delimiter of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidMonth:
+ {
+ message = "Format of the month portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidMonthDayDelimiter:
+ {
+ message = "A month-day delimiter of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidNanoSecond:
+ {
+ message = "Format of the nanosecond portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidSecond:
+ {
+ message = "Format of the second portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidSubsecondDelimiter:
+ {
+ message = "A second-nanosecond delimiter of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidYear:
+ {
+ message = "Format of the year portion of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindInvalidYearMonthDeilimiter:
+ {
+ message = "A year-month delimiter of the input is not valid.";
+ break;
+ }
+ case TimestampParseResult.KindLeadingWhitespaceNotSupported:
+ {
+ message = "Leading whitespaces in the input is not allowed.";
+ break;
+ }
+ case TimestampParseResult.KindMissingUtcSign:
+ {
+ message = "No time offset specifier 'Z' is missing in the input.";
+ break;
+ }
+ case TimestampParseResult.KindNull:
+ {
+ Contract.Assert(
+ ( result & TimestampParseResult.ExceptionTypeMask ) == TimestampParseResult.ArgumentNullException,
+ ( result & TimestampParseResult.ExceptionTypeMask ) + " == TimestampParseResult.ArgumentNullException"
+ );
+ message = null;
+ break;
+ }
+ case TimestampParseResult.KindTrailingWhitespaceNotSupported:
+ {
+ message = "Trailing whitespaces in the input is not allowed.";
+ break;
+ }
+ case TimestampParseResult.KindUnsupported:
+ {
+ message = "The specified format is not supported.";
+ break;
+ }
+ case TimestampParseResult.KindYearOutOfRange:
+ {
+ message = "The specified year is too small or too large.";
+ break;
+ }
+ default:
+ {
+ Contract.Assert( kind == TimestampParseResult.KindNoMatchedFormats, kind + " == TimestampParseResult.KindNoMatchedFormats" );
+ message = "The input is not valid Timestamp.";
+ break;
+ }
+ }
+
+ switch( result & TimestampParseResult.ExceptionTypeMask )
+ {
+ case TimestampParseResult.ArgumentNullException:
+ {
+ throw new ArgumentNullException( parameterName );
+ }
+ case TimestampParseResult.ArgumentException:
+ {
+ throw new ArgumentException( message, parameterName );
+ }
+ default:
+ {
+ Contract.Assert(
+ ( result & TimestampParseResult.ExceptionTypeMask ) == TimestampParseResult.FormatException,
+ ( result & TimestampParseResult.ExceptionTypeMask ) + " == TimestampParseResult.FormatException"
+ );
+ throw new FormatException( message );
+ }
+ }
+ }
+ }
+}
diff --git a/src/MsgPack/Timestamp.Properties.cs b/src/MsgPack/Timestamp.Properties.cs
new file mode 100644
index 000000000..86d1aa8b4
--- /dev/null
+++ b/src/MsgPack/Timestamp.Properties.cs
@@ -0,0 +1,502 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+#if UNITY_5 || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
+#define UNITY
+#endif
+
+using System;
+#if CORE_CLR || UNITY || NETSTANDARD1_1
+using Contract = MsgPack.MPContract;
+#else
+using System.Diagnostics.Contracts;
+#endif // CORE_CLR || UNITY || NETSTANDARD1_1
+
+namespace MsgPack
+{
+ partial struct Timestamp
+ {
+ private const int SecondsPerMinutes = 60;
+ private const int SecondsPerHours = SecondsPerMinutes * 60;
+ private const int SecondsPerDay = SecondsPerHours * 24;
+
+ private const int DaysPerYear = 365;
+ private const int DaysPer4Years = DaysPerYear * 4 + 1;
+ private const int DaysPer100Years = DaysPer4Years * 25 - 1;
+ private const int DaysPer400Years = DaysPer100Years * 4 + 1;
+
+ private const int DayOfWeekOfEpoc = 4; // day of week of 1970-01-01
+
+ private static readonly uint[] DaysToMonth365 = new uint[] { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
+ private static readonly uint[] DaysToMonth366 = new uint[] { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 };
+ private static readonly uint[] ReversedDaysToMonth365 = new uint[] { 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 334, 365 };
+ private static readonly uint[] ReversedDaysToMonth366 = new uint[] { 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 335, 366 };
+
+ ///
+ /// Gets a unix epoch seconds part of msgpack timestamp spec.
+ ///
+ /// A value of unix epoch seconds part of msgpack timestamp spec. This value may be negative, BC dates, and dates after 9999-12-31.
+ ///
+ /// If you want to get "nanosecond" portion of this instance, use property instead.
+ ///
+ public long UnixEpochSecondsPart
+ {
+ get { return this.unixEpochSeconds; }
+ }
+
+ ///
+ /// Gets a nanoseconds part of msgpack timestamp spec.
+ ///
+ /// A value of nanoseconds part of msgpack timestamp spec. This value will be between 0 to 999,999,999.
+ ///
+ /// If you want to get "nanosecond" portion of this instance, use property instead.
+ ///
+ public int NanosecondsPart
+ {
+ get { return unchecked( ( int )this.nanoseconds ); }
+ }
+
+ ///
+ /// Gets an year portion of this instance.
+ ///
+ /// An year portion of this instance. The value may be zero or negative, and may exceed 9,999.
+ public long Year
+ {
+ get
+ {
+ long year;
+ int month, day, dayOfYear;
+ this.GetDatePart( out year, out month, out day, out dayOfYear );
+ return year;
+ }
+ }
+
+ ///
+ /// Gets a month portion of this instance.
+ ///
+ /// A month portion of this instance. The value will be between 1 and 12.
+ public int Month
+ {
+ get
+ {
+ long year;
+ int month, day, dayOfYear;
+ this.GetDatePart( out year, out month, out day, out dayOfYear );
+ return month;
+ }
+ }
+
+ ///
+ /// Gets a day portion of this instance.
+ ///
+ /// A day portion of this instance. The value will be valid day of .
+ public int Day
+ {
+ get
+ {
+ long year;
+ int month, day, dayOfYear;
+ this.GetDatePart( out year, out month, out day, out dayOfYear );
+ return day;
+ }
+ }
+
+ ///
+ /// Gets an hour portion of this instance.
+ ///
+ /// An hour portion of this instance. The value will be between 0 and 59.
+ public int Hour
+ {
+ get
+ {
+ long remainder;
+ var hour = DivRem( this.unixEpochSeconds, SecondsPerHours, out remainder ) % 24;
+ unchecked
+ {
+ return
+ ( int )( this.unixEpochSeconds < 0
+ ? hour + ( remainder != 0 ? 23 : ( hour < 0 ? 24 : 0 ) )
+ : hour
+ );
+ }
+ }
+ }
+
+ ///
+ /// Gets a minute portion of this instance.
+ ///
+ /// A minute portion of this instance. The value will be between 0 and 59.
+ public int Minute
+ {
+ get
+ {
+ long remainder;
+ var minute = DivRem( this.unixEpochSeconds, SecondsPerMinutes, out remainder ) % 60;
+ unchecked
+ {
+ return
+ ( int )( this.unixEpochSeconds < 0
+ ? minute + ( remainder != 0 ? 59 : ( minute < 0 ? 60 : 0 ) )
+ : minute
+ );
+ }
+ }
+ }
+
+ ///
+ /// Gets a second portion of this instance.
+ ///
+ /// A second portion of this instance. The value will be between 0 and 59.
+ public int Second
+ {
+ get
+ {
+ var second = unchecked( ( int )( this.unixEpochSeconds % 60 ) );
+ return second < 0 ? second + 60 : second;
+ }
+ }
+
+ ///
+ /// Gets a millisecond portion of this instance.
+ ///
+ /// A millisecond portion of this instance. The value will be between 0 and 999.
+ public int Millisecond
+ {
+ get { return this.NanosecondsPart / ( 1000 * 1000 ); }
+ }
+
+ ///
+ /// Gets a microsecond portion of this instance.
+ ///
+ /// A microsecond portion of this instance. The value will be between 0 and 999.
+ public int Microsecond
+ {
+ get { return ( this.NanosecondsPart / 1000 ) % 1000; }
+ }
+
+ ///
+ /// Gets a nanosecond portion of this instance.
+ ///
+ /// A nanosecond portion of this instance. The value will be between 0 and 999.
+ ///
+ /// If you want to get "nanoseconds" part of msgpack timestamp spec, use property instead.
+ ///
+ public int Nanosecond
+ {
+ get { return ( this.NanosecondsPart ) % 1000; }
+ }
+
+ ///
+ /// Gets a which only contains date portion of this instance.
+ ///
+ /// A which only contains date portion of this instance.
+ public Timestamp Date
+ {
+ get
+ {
+ return new Timestamp( this.unixEpochSeconds - this.TimeOfDay.unixEpochSeconds, 0 );
+ }
+ }
+
+ ///
+ /// Gets a which only contains time portion of this instance.
+ ///
+ /// A which only contains time portion of this instance.
+ public Timestamp TimeOfDay
+ {
+ get
+ {
+ return
+ new Timestamp(
+ this.unixEpochSeconds < 0 ? ( this.unixEpochSeconds % SecondsPerDay + SecondsPerDay ) : ( this.unixEpochSeconds % SecondsPerDay ),
+ this.NanosecondsPart
+ );
+ }
+ }
+
+ ///
+ /// Gets a of this day.
+ ///
+ /// A of this day.
+ public DayOfWeek DayOfWeek
+ {
+ get
+ {
+ long remainder;
+ var divided = unchecked( ( int )DivRem( this.unixEpochSeconds, SecondsPerDay, out remainder ));
+ return
+ ( DayOfWeek )(
+ (
+ ( this.unixEpochSeconds < 0
+ ? ( ( divided + ( ( int )remainder < 0 ? -1 : 0 ) ) % 7 + 7 )
+ : divided
+ ) + DayOfWeekOfEpoc
+ ) % 7
+ );
+ }
+ }
+
+ ///
+ /// Gets a number of days of this year.
+ ///
+ /// A number of days of this year.
+ public int DayOfYear
+ {
+ get
+ {
+ long year;
+ int month, day, dayOfYear;
+ this.GetDatePart( out year, out month, out day, out dayOfYear );
+ return dayOfYear;
+ }
+ }
+
+ ///
+ /// Gets a value which indicates is leap year or not.
+ ///
+ ///
+ /// true, when is leap year; otherwise, false.
+ ///
+ ///
+ /// A of B.C.1 is 0, so if the is 0 then it is leap year.
+ /// In addition, B.C.3 (the is -3) is leap year, B.C.99 (the is -100) is not,
+ /// and B.C.399 (the is -400) is leap year.
+ ///
+ public bool IsLeapYear
+ {
+ get { return IsLeapYearInternal( this.Year ); }
+ }
+
+ internal static bool IsLeapYearInternal( long year )
+ {
+ // Note: This algorithm assumes that BC uses leap year same as AD and B.C.1 is 0.
+ // This algorithm avoids remainder operation as possible.
+ return !( year % 4 != 0 || ( year % 100 == 0 && year % 400 != 0 ) );
+ }
+
+ internal static int GetLastDay( int month, bool isLeapYear )
+ {
+ var lastDay = LastDays[ month ];
+ if ( month == 2 )
+ {
+ lastDay = isLeapYear ? 29 : 28;
+ }
+
+ return lastDay;
+ }
+
+ private void GetDatePart( out long year, out int month, out int day, out int dayOfYear )
+ {
+ if ( this.unixEpochSeconds < -UnixEpochInSeconds )
+ {
+ this.GetDatePartBC( out year, out month, out day, out dayOfYear );
+ }
+ else
+ {
+ this.GetDatePartAD( out year, out month, out day, out dayOfYear );
+ }
+ }
+
+ private void GetDatePartAD( out long year, out int month, out int day, out int dayOfYear )
+ {
+ Contract.Assert( this.unixEpochSeconds >= -UnixEpochInSeconds, this.unixEpochSeconds + " > " + ( -UnixEpochInSeconds ) );
+
+ // From coreclr System.DateTime.cs
+ // https://github.com/dotnet/coreclr/blob/0825741447c14a6a70c60b7c429e16f95214e74e/src/mscorlib/shared/System/DateTime.cs#L863
+
+ // First, use 0001-01-01 as epoch to simplify leap year calculation
+ var seconds = unchecked( ( ulong )( this.unixEpochSeconds + UnixEpochInSeconds ) );
+
+ // number of days since 0001-01-01
+ var daysOffset = seconds / SecondsPerDay;
+
+ // number of whole 400-year periods since 0001-01-01
+ var numberOf400Years = daysOffset / DaysPer400Years;
+ // day number within 400-year period
+ var daysIn400Years = unchecked( ( uint )( daysOffset - numberOf400Years * DaysPer400Years ) );
+
+ // number of whole 100-year periods within 400-year period
+ var numberOf100Years = daysIn400Years / DaysPer100Years;
+ // Last 100-year period has an extra day, so decrement result if 4
+ if ( numberOf100Years == 4 )
+ {
+ numberOf100Years = 3;
+ }
+
+ // day number within 100-year period
+ var daysIn100Years = daysIn400Years - numberOf100Years * DaysPer100Years;
+
+ // number of whole 4-year periods within 100-year period
+ var numberOf4years = daysIn100Years / DaysPer4Years;
+ // day number within 4-year period
+ var daysIn4Years = daysIn100Years - numberOf4years * DaysPer4Years;
+
+ // number of whole years within 4-year period
+ var numberOf1Year = daysIn4Years / DaysPerYear;
+ // Last year has an extra day, so decrement result if 4
+ if ( numberOf1Year == 4 )
+ {
+ numberOf1Year = 3;
+ }
+
+ // compute year
+ year = unchecked( ( long )( numberOf400Years * 400 + numberOf100Years * 100 + numberOf4years * 4 + numberOf1Year + 1 ) );
+ // day number within year
+ var daysInYear = daysIn4Years - numberOf1Year * DaysPerYear;
+ dayOfYear = unchecked( ( int )( daysInYear + 1 ) );
+ // Leap year calculation
+ var isLeapYear = numberOf1Year == 3 && ( numberOf4years != 24 || numberOf100Years == 3 );
+ var days = isLeapYear ? DaysToMonth366 : DaysToMonth365;
+ // All months have less than 32 days, so n >> 5 is a good conservative
+ // estimate for the month
+ var numberOfMonth = ( daysInYear >> 5 ) + 1;
+#if DEBUG
+ Contract.Assert( numberOfMonth <= 12, numberOfMonth + "<= 12, daysInYear = " + daysInYear );
+#endif // DEBUG
+ // m = 1-based month number
+ while ( daysInYear >= days[ numberOfMonth ] )
+ {
+ numberOfMonth++;
+#if DEBUG
+ Contract.Assert( numberOfMonth <= 12, numberOfMonth + "<= 12, daysInYear = " + daysInYear );
+#endif // DEBUG
+ }
+ // compute month and day
+ month = unchecked( ( int )numberOfMonth );
+ day = unchecked( ( int )( daysInYear - days[ numberOfMonth - 1 ] + 1 ) );
+ }
+
+ private void GetDatePartBC( out long year, out int month, out int day, out int dayOfYear )
+ {
+ Contract.Assert( this.unixEpochSeconds < -UnixEpochInSeconds, this.unixEpochSeconds + " > " + ( -UnixEpochInSeconds ) );
+
+ // From coreclr System.DateTime.cs
+ // https://github.com/dotnet/coreclr/blob/0825741447c14a6a70c60b7c429e16f95214e74e/src/mscorlib/shared/System/DateTime.cs#L863
+
+ // First, use 0001-01-01 as epoch to simplify leap year calculation.
+ // This method calculate negative offset from 0001-01-01.
+ var seconds = unchecked( ( ulong )( ( this.unixEpochSeconds + UnixEpochInSeconds ) * -1 ) );
+
+ // number of days since 0001-01-01
+ var daysOffset = seconds / SecondsPerDay;
+ daysOffset += ( seconds % SecondsPerDay ) > 0 ? 1u : 0u;
+
+ // number of whole 400-year periods since 0001-01-01
+ var numberOf400Years = ( daysOffset - 1 ) / DaysPer400Years; // decrement offset 1 to adjust 1 to 12-31
+ // day number within 400-year period
+ var daysIn400Years = unchecked( ( uint )( daysOffset - numberOf400Years * DaysPer400Years ) );
+
+ // number of whole 100-year periods within 400-year period
+ var numberOf100Years =
+ daysIn400Years <= ( DaysPer100Years + 1 ) // 1st year is leap year (power of 400)
+ ? 0
+ : ( ( daysIn400Years - 2 ) / DaysPer100Years ); // decrement 1st leap year day and offset 1 to adjust 1 to 12-31
+
+ // day number within 100-year period
+ var daysIn100Years = daysIn400Years - numberOf100Years * DaysPer100Years;
+
+ // number of whole 4-year periods within 100-year period
+ var numberOf4years =
+ daysIn100Years == 0
+ ? 0
+ : ( ( daysIn100Years - 1 ) / DaysPer4Years ); // decrement offset 1 to adjust 1 to 12-31
+
+ // day number within 4-year period
+ var daysIn4Years = daysIn100Years - numberOf4years * DaysPer4Years;
+
+ // number of whole years within 4-year period
+ var numberOf1Year =
+ daysIn4Years <= ( DaysPerYear + ( numberOf4years != 0 ? 1 : 0 ) ) // is leap year in 4 years range?
+ ? 0
+ : ( ( daysIn4Years - 2 ) / DaysPerYear ); // decrement 1st leap year day and offset 1 to adjust 1 to 12-31
+
+ // compute year, note that 0001 -1 is 0000 (=B.C.1)
+ year = -unchecked( ( long )( numberOf400Years * 400 + numberOf100Years * 100 + numberOf4years * 4 + numberOf1Year ) );
+ var isLeapYear = numberOf1Year == 0 && ( numberOf4years != 0 || numberOf100Years == 0 );
+ // day number within year
+ var daysInYear =
+ isLeapYear
+ ? ( 366 - daysIn4Years )
+ : ( 365 - ( daysIn4Years - 1 - numberOf1Year * DaysPerYear ) );
+
+ dayOfYear = unchecked( ( int )( daysInYear + 1 ) );
+ // Leap year calculation
+ var days = isLeapYear ? DaysToMonth366 : DaysToMonth365;
+ // All months have more than 32 days, so n >> 5 is a good conservative
+ // estimate for the month
+ var numberOfMonth = ( daysInYear >> 5 ) + 1;
+#if DEBUG
+ Contract.Assert( numberOfMonth <= 12, numberOfMonth + "<= 12, daysInYear = " + daysInYear );
+#endif // DEBUG
+ // m = 1-based month number
+ while ( daysInYear >= days[ numberOfMonth ] )
+ {
+ numberOfMonth++;
+#if DEBUG
+ Contract.Assert( numberOfMonth <= 12, numberOfMonth + "<= 12, daysInYear = " + daysInYear );
+#endif // DEBUG
+ }
+ // compute month and day
+ month = unchecked( ( int )numberOfMonth );
+ day = unchecked( ( int )( daysInYear - days[ numberOfMonth - 1 ] + 1 ) );
+ }
+
+ ///
+ /// Gets a instance which represents today on UTC. The result only contains date part.
+ ///
+ /// A instance which represents today on UTC. The result only contains date part.
+ ///
+ /// For underlying system API restriction, this method cannot work after 9999-12-31 in current implementation.
+ ///
+ public static Timestamp Today
+ {
+ get { return UtcNow.Date; }
+ }
+
+ ///
+ /// Gets a instance of now on UTC.
+ ///
+ /// A instance of now on UTC.
+ ///
+ ///
+ /// For underlying system API restriction, this method cannot work after 9999-12-31T23:59:59.999999900 in current implementation.
+ ///
+ ///
+ /// In addition, the precision of the returned will be restricted by underlying platform.
+ /// In current implementation, the precision is 100 nano-seconds at most, and about 1/60 milliseconds on normal Windows platform.
+ ///
+ ///
+ public static Timestamp UtcNow
+ {
+ get
+ {
+ var now = DateTimeOffset.UtcNow;
+ return new Timestamp(
+#if !NET35 && !NET45 && !NETSTANDARD1_1 && !UNITY && !SILVERLIGHT
+ now.ToUnixTimeSeconds(),
+#else // !NET35 && !NET45 && !NETSTANDARD1_1 && !UNITY && !SILVERLIGHT
+ ( now.Ticks / TimeSpan.TicksPerSecond ) - UnixEpochInSeconds,
+#endif // !NET35 && !NET45 && !NETSTANDARD1_1 && !UNITY && !SILVERLIGHT
+ unchecked( ( int )( now.Ticks % 10000000 * 100 ) )
+ );
+ }
+ }
+ }
+}
diff --git a/src/MsgPack/Timestamp.ToString.cs b/src/MsgPack/Timestamp.ToString.cs
new file mode 100644
index 000000000..95342e5f4
--- /dev/null
+++ b/src/MsgPack/Timestamp.ToString.cs
@@ -0,0 +1,137 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+using System.Globalization;
+using System.Text;
+
+namespace MsgPack
+{
+ partial struct Timestamp : IFormattable
+ {
+ ///
+ /// Returns a representation of this instance with the default format and the default format provider.
+ ///
+ ///
+ /// A representation of this instance.
+ ///
+ ///
+ ///
+ /// As of recommendation of the msgpack specification and consistency with and ,
+ /// this overload uses "o" for the format parameter and null for formatProvider parameter.
+ ///
+ ///
+ /// The round trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z' which 'fffffffff' nanoseconds.
+ ///
+ ///
+ public override string ToString()
+ {
+ return this.ToString( null, null );
+ }
+
+ ///
+ /// Returns a representation of this instance with the default format and the specified format provider.
+ ///
+ ///
+ /// An to provide culture specific format information.
+ /// You can specify null for default behavior, which uses .
+ ///
+ ///
+ /// A representation of this instance.
+ ///
+ ///
+ ///
+ /// As of recommendation of the msgpack specification and consistency with and ,
+ /// this overload uses "o" for format parameter.
+ ///
+ ///
+ /// The round trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z' which 'fffffffff' nanoseconds.
+ ///
+ ///
+ public string ToString( IFormatProvider formatProvider )
+ {
+ return this.ToString( null, formatProvider );
+ }
+
+ ///
+ /// Returns a representation of this instance with the specified format and the default format provider.
+ ///
+ ///
+ /// A format string to specify output format. You can specify null for default behavior, which is interpreted as "o".
+ ///
+ ///
+ /// A representation of this instance.
+ ///
+ ///
+ ///
+ /// Currently, only "o" and "O" (ISO 8601 like round trip format) and "s" (ISO 8601 format) are supported.
+ /// Other standard date time format and any custom date time format are not supported.
+ ///
+ ///
+ /// The round trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z' which 'fffffffff' nanoseconds.
+ ///
+ ///
+ /// As of recommendation of the msgpack specification and consistency with and ,
+ /// this overload uses null for formatProvider parameter.
+ ///
+ ///
+ public string ToString( string format )
+ {
+ return this.ToString( format, null );
+ }
+
+ ///
+ /// Returns a representation of this instance with the default format and the specified format provider.
+ ///
+ ///
+ /// A format string to specify output format. You can specify null for default behavior, which is interpreted as "o".
+ ///
+ ///
+ /// An to provide culture specific format information.
+ /// You can specify null for default behavior, which uses .
+ ///
+ ///
+ /// A representation of this instance.
+ ///
+ ///
+ /// is not valid.
+ ///
+ ///
+ ///
+ /// Currently, only "o" and "O" (ISO 8601 like round trip format) and "s" (ISO 8601 format) are supported.
+ /// Other standard date time format and any custom date time format are not supported.
+ ///
+ ///
+ /// The round trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z' which 'fffffffff' nanoseconds.
+ ///
+ ///
+ /// As of recommendation of the msgpack specification and consistency with and ,
+ /// the default value of the is "o" (ISO 8601 like round-trip format)
+ /// and the default value of the is null (.
+ /// If you want to ensure interoperability for other implementation, specify "s" and resepectively.
+ ///
+ ///
+ public string ToString( string format, IFormatProvider formatProvider )
+ {
+ var value = new Value( this );
+ return TimestampStringConverter.ToString( format, formatProvider, ref value );
+ }
+ }
+}
diff --git a/src/MsgPack/Timestamp.TryParseExact.cs b/src/MsgPack/Timestamp.TryParseExact.cs
new file mode 100644
index 000000000..568604ece
--- /dev/null
+++ b/src/MsgPack/Timestamp.TryParseExact.cs
@@ -0,0 +1,195 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+#if UNITY_5 || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
+#define UNITY
+#endif
+
+using System;
+#if CORE_CLR || UNITY || NETSTANDARD1_1
+using Contract = MsgPack.MPContract;
+#else
+using System.Diagnostics.Contracts;
+#endif // CORE_CLR || UNITY || NETSTANDARD1_1
+using System.Globalization;
+
+namespace MsgPack
+{
+ partial struct Timestamp
+ {
+ ///
+ /// Converts specified representation of a msgpack timestamp to its equivalant
+ /// with specified format, culture-specific format information provider, and .
+ ///
+ /// An input representation of a msgpack timestamp. The format must be match exactly to the .
+ /// An expected format string.
+ /// An to provide culture specific information to parse .
+ ///
+ /// Specify bitwise value combination of to control detailed parsing behavior.
+ /// The typical value is .
+ ///
+ /// If the conversion succeeded, the conversion result will be stored; otherwise, the default value will be stored.
+ /// true, if the conversion succeeded; otherwise, false.
+ ///
+ ///
+ /// Currently, supported date-time format is only 'o' and 'O' (round-trip) or 's' (sortable, ISO-8601).
+ /// Other any standard date-time formats and custom date-time formats are not supported.
+ ///
+ ///
+ /// The rount-trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z' which "fffffffff" is nanoseconds.
+ ///
+ ///
+ /// The sign mark can be culture-specific, and leading/trailing whitespaces can be allowed when specify appropriate .
+ ///
+ ///
+ ///
+ /// is null.
+ /// Or, is null.
+ ///
+ ///
+ /// The specified is not supported.
+ /// Or the specified has invalid combination.
+ ///
+ public static bool TryParseExact( string input, string format, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result )
+ {
+ return TryParseExactCore( input, format, formatProvider, styles, out result ) == TimestampParseResult.Success;
+ }
+
+ ///
+ /// Converts specified representation of a msgpack timestamp to its equivalant
+ /// with specified format, culture-specific format information provider, and .
+ ///
+ /// The input representation of a msgpack timestamp. The format must be match exactly to one of the .
+ /// The array of expected format strings. Unsupported format will be ignored.
+ /// The culture specific information to control
+ ///
+ /// Specify bitwise value combination of to control detailed parsing behavior.
+ /// The typical value is .
+ ///
+ /// If the conversion succeeded, the conversion result will be stored; otherwise, the default value will be stored.
+ /// true, if the conversion succeeded; otherwise, false.
+ ///
+ ///
+ /// Currently, supported date-time format is only 'o' and 'O' (round-trip) or 's' (sortable, ISO-8601).
+ /// Other any standard date-time formats and custom date-time formats are not supported.
+ ///
+ ///
+ /// The rount-trip format is yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffff'Z' which "fffffffff" is nanoseconds.
+ ///
+ ///
+ /// The sign mark can be culture-specific, and leading/trailing whitespaces can be allowed when specify appropriate .
+ ///
+ ///
+ ///
+ /// is null.
+ /// Or, is null.
+ ///
+ ///
+ /// The specified is empty.
+ /// Or the specified has invalid combination.
+ ///
+ public static bool TryParseExact( string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result )
+ {
+ return TryParseExactCore( input, formats, formatProvider, styles, out result ) == TimestampParseResult.Success;
+ }
+
+ private static TimestampParseResult TryParseExactCore( string input, string format, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result )
+ {
+ ValidateParseInput( input );
+
+ if ( input.Length == 0 )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.EmptyInput;
+ }
+
+ if ( format == null )
+ {
+ throw new ArgumentNullException( "format" );
+ }
+
+ if ( format.Length == 0 )
+ {
+ throw new ArgumentException( "The 'format' must not be empty.", "format" );
+ }
+
+ ValidateParseStyles( styles );
+
+ var error = TimestampStringConverter.TryParseExact( input, format, formatProvider, styles, out result );
+ if ( error == TimestampParseResult.UnsupportedFormat )
+ {
+ // UnsupportedFormat should throw Exception instead of returning false.
+ HandleParseResult( error, "Cannot parse specified input with specified format." );
+ }
+
+ return error;
+ }
+
+ private static TimestampParseResult TryParseExactCore( string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result )
+ {
+ ValidateParseInput( input );
+
+ if ( formats == null )
+ {
+ throw new ArgumentNullException( "formats" );
+ }
+
+ if ( formats.Length == 0 )
+ {
+ throw new ArgumentException( "The 'formats' must not be empty.", "formats" );
+ }
+
+ ValidateParseStyles( styles );
+
+ if ( input.Length == 0 )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.EmptyInput;
+ }
+
+ foreach ( var format in formats )
+ {
+ if ( TimestampStringConverter.TryParseExact( input, format, formatProvider, styles, out result ) == TimestampParseResult.Success )
+ {
+ return TimestampParseResult.Success;
+ }
+ }
+
+ result = default( Timestamp );
+ return TimestampParseResult.NoMatchedFormats;
+ }
+
+ private static void ValidateParseInput( string input )
+ {
+ if ( input == null )
+ {
+ throw new ArgumentNullException( "input" );
+ }
+ }
+
+ private static void ValidateParseStyles( DateTimeStyles styles )
+ {
+ if ( styles != DateTimeStyles.None && ( styles & ~( DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite ) ) != 0 )
+ {
+ throw new ArgumentException( "Timestamp currently only support DateTimeStyles.None, DateTimeStyles.AllowLeadingWhite, and DateTimeStyles.AllowTrailingWhite.", "styles" );
+ }
+ }
+ }
+}
diff --git a/src/MsgPack/Timestamp.cs b/src/MsgPack/Timestamp.cs
new file mode 100644
index 000000000..1a79c21e2
--- /dev/null
+++ b/src/MsgPack/Timestamp.cs
@@ -0,0 +1,224 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+
+namespace MsgPack
+{
+ ///
+ /// Represents high resolution timestamp for MessagePack eco-system.
+ ///
+ ///
+ /// The timestamp consists of 64bit Unix epoc seconds and 32bit unsigned nanoseconds offset from the calculated datetime with the epoc.
+ /// So this type supports wider range than and and supports 1 or 10 nano seconds precision.
+ /// However, this type does not support local date time and time zone information, so this type always represents UTC time.
+ ///
+#if FEATURE_BINARY_SERIALIZATION
+ [Serializable]
+#endif // FEATURE_BINARY_SERIALIZATION
+ public partial struct Timestamp
+ {
+ ///
+ /// MessagePack ext type code for msgpack timestamp type.
+ ///
+ public const byte TypeCode = 0xFF;
+
+ ///
+ /// An instance represents zero. This is 1970-01-01T00:00:00.000000000.
+ ///
+ public static readonly Timestamp Zero = new Timestamp( 0, 0 );
+
+ ///
+ /// An instance represents minimum value of this instance. This is [, 0] in encoded format.
+ ///
+ public static readonly Timestamp MinValue = new Timestamp( Int64.MinValue, 0 );
+
+ ///
+ /// An instance represents maximum value of this instance. This is [, 999999999] in encoded format.
+ ///
+ public static readonly Timestamp MaxValue = new Timestamp( Int64.MaxValue, MaxNanoSeconds );
+
+ private static readonly int[] LastDays =
+ new[]
+ {
+ 0, // There are no month=0
+ 31,
+ 0, // 28 or 29
+ 31,
+ 30,
+ 31,
+ 30,
+ 31,
+ 31,
+ 30,
+ 31,
+ 30,
+ 31
+ };
+
+ private const long MinUnixEpochSecondsForTicks = -62135596800L;
+ private const long MaxUnixEpochSecondsForTicks = 253402300799;
+
+ private const int MaxNanoSeconds = 999999999;
+
+ private const long UnixEpochTicks = 621355968000000000;
+ private const long UnixEpochInSeconds = 62135596800;
+ private const int SecondsToTicks = 10 * 1000 * 1000;
+ private const int NanoToTicks = 100;
+ private const int SecondsToNanos = 1000 * 1000 * 1000;
+
+ private readonly long unixEpochSeconds;
+ private readonly uint nanoseconds; // 0 - 999,999,999
+
+ ///
+ /// Initializes a new instance of structure.
+ ///
+ /// A unit epoc seconds part of the msgpack timestamp.
+ /// A unit nanoseconds part of the msgpack timestamp.
+ ///
+ /// is negative or is greater than 999,999,999 exclusive.
+ ///
+ public Timestamp( long unixEpochSeconds, int nanoseconds )
+ {
+ if ( nanoseconds > MaxNanoSeconds || nanoseconds < 0 )
+ {
+ throw new ArgumentOutOfRangeException( "nanoseconds", "nanoseconds must be non negative value and lessor than 999,999,999." );
+ }
+
+ this.unixEpochSeconds = unixEpochSeconds;
+ this.nanoseconds = unchecked( ( uint )nanoseconds );
+ }
+
+ internal static Timestamp FromComponents( ref Value value, bool isLeapYear )
+ {
+ long epoc;
+ checked
+ {
+ var days = YearsToDaysOfNewYear( value.Year ) + ToDaysOffsetFromNewYear( value.Month, value.Day, isLeapYear ) - Timestamp.UnixEpochInSeconds / Timestamp.SecondsPerDay;
+ // First set time offset to avoid overflow.
+ epoc = value.Hour * 60 * 60;
+ epoc += value.Minute * 60;
+ epoc += value.Second;
+ if ( days < 0 )
+ {
+ // Avoid right side overflow.
+ epoc += ( days + 1 ) * Timestamp.SecondsPerDay;
+ epoc -= Timestamp.SecondsPerDay;
+ }
+ else
+ {
+ epoc += days * Timestamp.SecondsPerDay;
+ }
+ }
+
+ return new Timestamp( epoc, unchecked( ( int )value.Nanoseconds ) );
+ }
+
+ private static long YearsToDaysOfNewYear( long years )
+ {
+ long remainOf400Years, remainOf100Years, remainOf4Years;
+
+ // For AD, uses offset from 0001, so decrement 1 at first.
+ var numberOf400Years = DivRem( years > 0 ? ( years - 1 ) : years, 400, out remainOf400Years );
+ var numberOf100Years = DivRem( remainOf400Years, 100, out remainOf100Years );
+ var numberOf4Years = DivRem( remainOf100Years, 4, out remainOf4Years );
+ var days =
+ DaysPer400Years * numberOf400Years +
+ DaysPer100Years * numberOf100Years +
+ DaysPer4Years * numberOf4Years +
+ DaysPerYear * remainOf4Years;
+ if ( years <= 0 )
+ {
+ // For BC, subtract year 0000 offset.
+ days -= ( DaysPerYear + 1 );
+ }
+
+ return days;
+ }
+
+ private static int ToDaysOffsetFromNewYear( int month, int day, bool isLeapYear )
+ {
+ var result = -1; // 01-01 should be 0, so starts with -1.
+ for ( var i = 1; i < month; i++ )
+ {
+ result += LastDays[ i ];
+ if ( i == 2 )
+ {
+ result += isLeapYear ? 29 : 28;
+ }
+ }
+
+ result += day;
+ return result;
+ }
+
+#if NETSTANDARD1_1 || NETSTANDARD1_3 || SILVERLIGHT
+
+ // Slow alternative
+ internal static long DivRem( long dividend, long divisor, out long remainder )
+ {
+ remainder = dividend % divisor;
+ return dividend / divisor;
+ }
+
+#else // NETSTANDARD1_1 || NETSTANDARD1_3 || SILVERLIGHT
+
+ internal static long DivRem( long dividend, long divisor, out long remainder )
+ {
+ return Math.DivRem( dividend, divisor, out remainder );
+ }
+
+#endif // NETSTANDARD1_1 || NETSTANDARD1_3 || SILVERLIGHT
+
+ internal struct Value
+ {
+ public long Year;
+ public int Month;
+ public int Day;
+ public int Hour;
+ public int Minute;
+ public int Second;
+ public uint Nanoseconds;
+
+ public Value( Timestamp encoded )
+ {
+ int dayOfYear;
+ encoded.GetDatePart( out this.Year, out this.Month, out this.Day, out dayOfYear );
+ this.Hour = encoded.Hour;
+ this.Minute = encoded.Minute;
+ this.Second = encoded.Second;
+ this.Nanoseconds = encoded.nanoseconds;
+ }
+
+#if DEBUG
+ public Value( long year, int month, int day, int hour, int minute, int second, uint nanoseconds )
+ {
+ this.Year = year;
+ this.Month = month;
+ this.Day = day;
+ this.Hour = hour;
+ this.Minute = minute;
+ this.Second = second;
+ this.Nanoseconds = nanoseconds;
+ }
+#endif // DEBUG
+ }
+ }
+}
diff --git a/src/MsgPack/TimestampParseResult.cs b/src/MsgPack/TimestampParseResult.cs
new file mode 100644
index 000000000..2fb17e844
--- /dev/null
+++ b/src/MsgPack/TimestampParseResult.cs
@@ -0,0 +1,88 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+namespace MsgPack
+{
+ ///
+ /// Represents internal result.
+ ///
+ internal enum TimestampParseResult
+ {
+ Success = 0,
+
+ KindMask = 0xFFFF,
+ KindNull = 1,
+ KindEmpty = 2,
+ KindUnsupported = 3,
+ KindLeadingWhitespaceNotSupported = 11,
+ KindTrailingWhitespaceNotSupported = 12,
+ KindMissingUtcSign = 13,
+ KindExtraCharactors = 14,
+ KindInvalidYear = 21,
+ KindInvalidMonth = 22,
+ KindInvalidDay = 23,
+ KindInvalidHour = 24,
+ KindInvalidMinute = 25,
+ KindInvalidSecond = 26,
+ KindInvalidNanoSecond = 27,
+ KindYearOutOfRange = 31,
+ KindInvalidYearMonthDeilimiter = 101,
+ KindInvalidMonthDayDelimiter = 102,
+ KindInvalidDateTimeDelimiter = 103,
+ KindInvalidHourMinuteDelimiter = 104,
+ KindInvalidMinuteSecondDelimiter = 105,
+ KindInvalidSubsecondDelimiter = 106,
+ KindNoMatchedFormats = 1001,
+
+ ParameterMask = 0xFF << 16,
+ ParameterInput = 1 << 16,
+ ParameterFormat = 2 << 16,
+
+ ExceptionTypeMask = 0xFF << 24,
+ ArgumentNullException = 1 << 24,
+ ArgumentException = 2 << 24,
+ FormatException = 3 << 24,
+
+ NullInput = ArgumentNullException | ParameterInput | KindNull,
+ NullFormat = ArgumentNullException | ParameterFormat | KindNull,
+ EmptyInput = FormatException | ParameterInput | KindEmpty,
+ EmptyFormat = ArgumentException | ParameterFormat | KindEmpty,
+ UnsupportedFormat = ArgumentException | ParameterFormat | KindUnsupported,
+ LeadingWhitespaceNotAllowed = FormatException | ParameterInput | KindLeadingWhitespaceNotSupported,
+ TrailingWhitespaceNotAllowed = FormatException | ParameterInput | KindTrailingWhitespaceNotSupported,
+ MissingUtcSign = FormatException | ParameterInput | KindMissingUtcSign,
+ ExtraCharactors = FormatException | ParameterInput | KindExtraCharactors,
+ InvalidYear = FormatException | ParameterInput | KindInvalidYear,
+ InvalidMonth = FormatException | ParameterInput | KindInvalidMonth,
+ InvalidDay = FormatException | ParameterInput | KindInvalidDay,
+ InvalidHour = FormatException | ParameterInput | KindInvalidHour,
+ InvalidMinute = FormatException | ParameterInput | KindInvalidMinute,
+ InvalidSecond = FormatException | ParameterInput | KindInvalidSecond,
+ InvalidNanoSecond = FormatException | ParameterInput | KindInvalidNanoSecond,
+ YearOutOfRange = FormatException | ParameterInput | KindYearOutOfRange,
+ InvalidYearMonthDeilimiter = FormatException | ParameterInput | KindInvalidYearMonthDeilimiter,
+ InvalidMonthDayDelimiter = FormatException | ParameterInput | KindInvalidMonthDayDelimiter,
+ InvalidDateTimeDelimiter = FormatException | ParameterInput | KindInvalidDateTimeDelimiter,
+ InvalidHourMinuteDelimiter = FormatException | ParameterInput | KindInvalidHourMinuteDelimiter,
+ InvalidMinuteSecondDelimiter = FormatException | ParameterInput | KindInvalidMinuteSecondDelimiter,
+ InvalidSubsecondDelimiter = FormatException | ParameterInput | KindInvalidSubsecondDelimiter,
+ NoMatchedFormats = FormatException | ParameterInput | KindNoMatchedFormats
+ }
+}
diff --git a/src/MsgPack/TimestampStringConverter.Parse.cs b/src/MsgPack/TimestampStringConverter.Parse.cs
new file mode 100644
index 000000000..c221c9069
--- /dev/null
+++ b/src/MsgPack/TimestampStringConverter.Parse.cs
@@ -0,0 +1,349 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+using System.Globalization;
+
+namespace MsgPack
+{
+ partial class TimestampStringConverter
+ {
+ // Currently, custom format and normal date time format except 'o' or 'O' 's' are NOT supported.
+ public static TimestampParseResult TryParseExact( string input, string format, IFormatProvider formatProvider, DateTimeStyles styles, out Timestamp result )
+ {
+ if ( format != "o" && format != "O" && format != "s" )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.UnsupportedFormat;
+ }
+
+ var numberFormat = NumberFormatInfo.GetInstance( formatProvider );
+
+ var position = 0;
+ if ( !ParseWhitespace( input, ref position, ( styles & DateTimeStyles.AllowLeadingWhite ) != 0, /* isTrailing */false ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.LeadingWhitespaceNotAllowed;
+ }
+
+ long year;
+ if ( !ParseYear( input, ref position, numberFormat, out year ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidYear;
+ }
+
+ if ( !ParseDelimiter( input, ref position, DateDelimiter ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidYearMonthDeilimiter;
+ }
+
+ var isLeapYear = Timestamp.IsLeapYearInternal( year );
+
+ int month;
+ if ( !ParseDigitRange( input, 2, ref position, 1, 12, out month ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidMonth;
+ }
+
+ if ( !ParseDelimiter( input, ref position, DateDelimiter ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidMonthDayDelimiter;
+ }
+
+ int day;
+ if ( !ParseDay( input, ref position, month, isLeapYear, out day ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidDay;
+ }
+
+ if ( !ParseDelimiter( input, ref position, DateTimeDelimiter ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidDateTimeDelimiter;
+ }
+
+ int hour;
+ if ( !ParseDigitRange( input, 2, ref position, 0, 23, out hour ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidHour;
+ }
+
+ if ( !ParseDelimiter( input, ref position, TimeDelimiter ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidHourMinuteDelimiter;
+ }
+
+ int minute;
+ if ( !ParseDigitRange( input, 2, ref position, 0, 59, out minute ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidMinute;
+ }
+
+ if ( !ParseDelimiter( input, ref position, TimeDelimiter ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidMinuteSecondDelimiter;
+ }
+
+ int second;
+ if ( !ParseDigitRange( input, 2, ref position, 0, 59, out second ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidSecond;
+ }
+
+ var nanosecond = 0;
+ if ( format != "s" )
+ {
+ // "o" or "O"
+ if ( !ParseDelimiter( input, ref position, SubsecondDelimiter ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidSubsecondDelimiter;
+ }
+
+ if ( !ParseDigitRange( input, 9, ref position, 0, 999999999, out nanosecond ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.InvalidNanoSecond;
+ }
+ }
+
+ if ( !ParseDelimiter( input, ref position, UtcSign ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.MissingUtcSign;
+ }
+
+ if ( !ParseWhitespace( input, ref position, ( styles & DateTimeStyles.AllowTrailingWhite ) != 0, /* isTrailing */true ) )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.TrailingWhitespaceNotAllowed;
+ }
+
+ if ( position != input.Length )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.ExtraCharactors;
+ }
+
+ var components = new Timestamp.Value();
+ components.Year = year;
+ components.Month = month;
+ components.Day = day;
+ components.Hour = hour;
+ components.Minute = minute;
+ components.Second = second;
+ components.Nanoseconds = unchecked( ( uint )nanosecond );
+
+ try
+ {
+ result = Timestamp.FromComponents( ref components, isLeapYear );
+ }
+ catch ( OverflowException )
+ {
+ result = default( Timestamp );
+ return TimestampParseResult.YearOutOfRange;
+ }
+
+ return TimestampParseResult.Success;
+ }
+
+ private static bool ParseWhitespace( string input, ref int position, bool allowWhitespace, bool isTrailing )
+ {
+ if ( input.Length <= position )
+ {
+ return isTrailing;
+ }
+
+ if ( !allowWhitespace )
+ {
+ return !Char.IsWhiteSpace( input[ position ] );
+ }
+
+ while ( position < input.Length && Char.IsWhiteSpace( input[ position ] ) )
+ {
+ position++;
+ }
+
+ return true;
+ }
+
+ private static bool ParseDelimiter( string input, ref int position, char delimiter )
+ {
+ if ( input.Length <= position )
+ {
+ return false;
+ }
+
+ if ( input[ position ] != delimiter )
+ {
+ return false;
+ }
+
+ position++;
+ return true;
+ }
+
+ private static bool ParseSign( string input, ref int position, NumberFormatInfo numberFormat, out int sign )
+ {
+ if ( input.Length <= position )
+ {
+ sign = default( int );
+ return false;
+ }
+
+ if ( IsDigit( input[ position ] ) )
+ {
+ sign = 1;
+ return true;
+ }
+
+ if ( StartsWith( input, position, numberFormat.NegativeSign ) )
+ {
+ position += numberFormat.NegativeSign.Length;
+ sign = -1;
+ return true;
+ }
+
+ if ( StartsWith( input, position, numberFormat.PositiveSign ) )
+ {
+ position += numberFormat.NegativeSign.Length;
+ sign = 1;
+ return true;
+ }
+
+ sign = default( int );
+ return false;
+ }
+
+ private static bool StartsWith( string input, int startIndex, string comparison )
+ {
+ for ( var i = 0; i < comparison.Length; i++ )
+ {
+ if ( i + startIndex >= input.Length )
+ {
+ return false;
+ }
+
+ if ( input[ i + startIndex ] != comparison[ i ] )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static bool ParseDigit( string input, int minLength, ref int position, out long digit )
+ {
+ var startPosition = position;
+ var bits = 0L;
+ while ( position < input.Length )
+ {
+ var c = input[ position ];
+ if ( !IsDigit( c ) )
+ {
+ break;
+ }
+
+ bits = bits * 10 + ( c - '0' );
+ position++;
+ }
+
+ digit = bits;
+ return position >= startPosition + minLength;
+ }
+
+ private static bool IsDigit( char c )
+ {
+ return '0' <= c && c <= '9';
+ }
+
+ private static bool ParseDigitRange( string input, int minLength, ref int position, int min, int max, out int result )
+ {
+ long digit;
+ if ( !ParseDigit( input, minLength, ref position, out digit ) )
+ {
+ result = default( int );
+ return false;
+ }
+
+ if ( digit < min || max < digit )
+ {
+ result = default( int );
+ return false;
+ }
+
+ result = unchecked( ( int )digit );
+ return true;
+ }
+
+ private static bool ParseYear( string input, ref int position, NumberFormatInfo numberFormat, out long year )
+ {
+ int sign;
+ if ( !ParseSign( input, ref position, numberFormat, out sign ) )
+ {
+ year = default( long );
+ return false;
+ }
+
+ long digit;
+ if ( !ParseDigit( input, 4, ref position, out digit ) )
+ {
+ year = default( long );
+ return false;
+ }
+
+ // as of ISO 8601, 0001-01-01 -1 day is 0000-12-31.
+ year = digit * sign;
+ return true;
+ }
+
+ private static bool ParseDay( string input, ref int position, int month, bool isLeapYear, out int day )
+ {
+ long digit;
+ if ( !ParseDigit( input, 2, ref position, out digit ) )
+ {
+ day = default( int );
+ return false;
+ }
+
+ var lastDay = Timestamp.GetLastDay( month, isLeapYear );
+
+ if ( digit < 1 || lastDay < digit )
+ {
+ day = default( int );
+ return false;
+ }
+
+ day = unchecked( ( int )digit );
+ return true;
+ }
+ }
+}
diff --git a/src/MsgPack/TimestampStringConverter.ToString.cs b/src/MsgPack/TimestampStringConverter.ToString.cs
new file mode 100644
index 000000000..b21d6ed78
--- /dev/null
+++ b/src/MsgPack/TimestampStringConverter.ToString.cs
@@ -0,0 +1,82 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+using System.Globalization;
+using System.Text;
+
+namespace MsgPack
+{
+ partial class TimestampStringConverter
+ {
+ private const string DefaultFormat = "o";
+
+ public static string ToString( string format, IFormatProvider formatProvider, ref Timestamp.Value value )
+ {
+ switch ( format ?? DefaultFormat )
+ {
+ case "o":
+ case "O":
+ {
+ // round-trip
+ return ToIso8601String( formatProvider, /* containsNanoseconds */true, ref value );
+ }
+ case "s":
+ {
+ // sortable(ISO-8601)
+ return ToIso8601String( formatProvider, /* containsNanoseconds */false, ref value );
+ }
+ default:
+ {
+ throw new ArgumentException( "The specified format is not supported.", "format" );
+ }
+ }
+ }
+
+ private static string ToIso8601String( IFormatProvider formatProvider, bool containsNanosecons, ref Timestamp.Value value )
+ {
+ var numberFormat = NumberFormatInfo.GetInstance( formatProvider );
+
+ // Most cases are yyyy-MM-ddTHH:mm:ss[.fffffffff]Z -- 50 or 60 chars.
+ var buffer = new StringBuilder( 49 + ( containsNanosecons ? 11 : 1 ) );
+ buffer.Append( value.Year.ToString( "0000", formatProvider ) );
+ buffer.Append( DateDelimiter );
+ buffer.Append( value.Month.ToString( "00", formatProvider ) );
+ buffer.Append( DateDelimiter );
+ buffer.Append( value.Day.ToString( "00", formatProvider ) );
+ buffer.Append( DateTimeDelimiter );
+ buffer.Append( value.Hour.ToString( "00", formatProvider ) );
+ buffer.Append( TimeDelimiter );
+ buffer.Append( value.Minute.ToString( "00", formatProvider ) );
+ buffer.Append( TimeDelimiter );
+ buffer.Append( value.Second.ToString( "00", formatProvider ) );
+
+ if ( containsNanosecons )
+ {
+ buffer.Append( SubsecondDelimiter );
+ buffer.Append( value.Nanoseconds.ToString( "000000000", formatProvider ) );
+ }
+
+ buffer.Append( UtcSign );
+
+ return buffer.ToString();
+ }
+ }
+}
diff --git a/src/MsgPack/TimestampStringConverter.cs b/src/MsgPack/TimestampStringConverter.cs
new file mode 100644
index 000000000..be5efbe17
--- /dev/null
+++ b/src/MsgPack/TimestampStringConverter.cs
@@ -0,0 +1,37 @@
+#region -- License Terms --
+//
+// MessagePack for CLI
+//
+// Copyright (C) 2010-2015 FUJIWARA, Yusuke
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion -- License Terms --
+
+using System;
+using System.Globalization;
+
+namespace MsgPack
+{
+ ///
+ /// An internal parser and stringifier.
+ ///
+ internal static partial class TimestampStringConverter
+ {
+ private const char DateDelimiter = '-';
+ private const char TimeDelimiter = ':';
+ private const char DateTimeDelimiter = 'T';
+ private const char SubsecondDelimiter = '.';
+ private const char UtcSign = 'Z';
+ }
+}
diff --git a/test/MsgPack.UnitTest.BclExtensions/MsgPack.UnitTest.BclExtensions.csproj b/test/MsgPack.UnitTest.BclExtensions/MsgPack.UnitTest.BclExtensions.csproj
index ab7063f84..65af1b477 100644
--- a/test/MsgPack.UnitTest.BclExtensions/MsgPack.UnitTest.BclExtensions.csproj
+++ b/test/MsgPack.UnitTest.BclExtensions/MsgPack.UnitTest.BclExtensions.csproj
@@ -19,7 +19,7 @@
$(DefineConstants);NETSTANDARD2_0
-
+
diff --git a/test/MsgPack.UnitTest.CodeDom.Net35/MsgPack.UnitTest.CodeDom.Net35.csproj b/test/MsgPack.UnitTest.CodeDom.Net35/MsgPack.UnitTest.CodeDom.Net35.csproj
index 2cd1e4fd1..daefcc905 100644
--- a/test/MsgPack.UnitTest.CodeDom.Net35/MsgPack.UnitTest.CodeDom.Net35.csproj
+++ b/test/MsgPack.UnitTest.CodeDom.Net35/MsgPack.UnitTest.CodeDom.Net35.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/test/MsgPack.UnitTest.CodeDom/MsgPack.UnitTest.CodeDom.csproj b/test/MsgPack.UnitTest.CodeDom/MsgPack.UnitTest.CodeDom.csproj
index a766526b6..73d951e20 100644
--- a/test/MsgPack.UnitTest.CodeDom/MsgPack.UnitTest.CodeDom.csproj
+++ b/test/MsgPack.UnitTest.CodeDom/MsgPack.UnitTest.CodeDom.csproj
@@ -15,7 +15,7 @@
$(DefineConstants);NETSTANDARD2_0
-
+
diff --git a/test/MsgPack.UnitTest.CodeDom/Serialization/ArrayCodeDomBasedAutoMessagePackSerializerTest.cs b/test/MsgPack.UnitTest.CodeDom/Serialization/ArrayCodeDomBasedAutoMessagePackSerializerTest.cs
index 1b84b4cd4..49e097f0a 100644
--- a/test/MsgPack.UnitTest.CodeDom/Serialization/ArrayCodeDomBasedAutoMessagePackSerializerTest.cs
+++ b/test/MsgPack.UnitTest.CodeDom/Serialization/ArrayCodeDomBasedAutoMessagePackSerializerTest.cs
@@ -88,9 +88,15 @@ private static SerializationContext GetSerializationContext()
return context;
}
- private static SerializationContext NewSerializationContext( PackerCompatibilityOptions compatibilityOptions )
+ private static SerializationContext NewSerializationContext()
+ {
+ return NewSerializationContext( PackerCompatibilityOptions.None, DateTimeConversionMethod.Timestamp );
+ }
+
+ private static SerializationContext NewSerializationContext( PackerCompatibilityOptions compatibilityOptions, DateTimeConversionMethod dateTimeConversionMethod )
{
var context = new SerializationContext( compatibilityOptions ) { SerializationMethod = SerializationMethod.Array };
+ context.DefaultDateTimeConversionMethod = dateTimeConversionMethod;
context.SerializerOptions.EmitterFlavor = EmitterFlavor.CodeDomBased;
#if SILVERLIGHT && !SILVERLIGHT_PRIVILEGED
context.SerializerOptions.DisablePrivilegedAccess = true;
@@ -243,6 +249,34 @@ public void TestString()
[Test]
public void TestDateTime()
+ {
+ TestCore(
+ DateTime.UtcNow,
+ stream => MessagePackSerializer.UnpackMessagePackObject( stream ).AsTimestamp().ToDateTime(),
+ ( x, y ) => x.Equals( y ),
+ context =>
+ {
+ Assert.That( context.DefaultDateTimeConversionMethod, Is.EqualTo( DateTimeConversionMethod.Timestamp ) );
+ }
+ );
+ }
+
+ [Test]
+ public void TestDateTimeOffset()
+ {
+ TestCore(
+ DateTimeOffset.UtcNow,
+ stream => MessagePackSerializer.UnpackMessagePackObject( stream ).AsTimestamp().ToDateTimeOffset(),
+ ( x, y ) => x.Equals( y ),
+ context =>
+ {
+ Assert.That( context.DefaultDateTimeConversionMethod, Is.EqualTo( DateTimeConversionMethod.Timestamp ) );
+ }
+ );
+ }
+
+ [Test]
+ public void TestDateTimeNative()
{
TestCore(
DateTime.Now,
@@ -250,13 +284,13 @@ public void TestDateTime()
( x, y ) => x.Equals( y ),
context =>
{
- Assert.That( context.DefaultDateTimeConversionMethod, Is.EqualTo( DateTimeConversionMethod.Native ) );
+ context.DefaultDateTimeConversionMethod = DateTimeConversionMethod.Native;
}
);
}
[Test]
- public void TestDateTimeOffset()
+ public void TestDateTimeOffsetNative()
{
TestCore(
DateTimeOffset.Now,
@@ -268,7 +302,7 @@ public void TestDateTimeOffset()
( x, y ) => x.Equals( y ),
context =>
{
- Assert.That( context.DefaultDateTimeConversionMethod, Is.EqualTo( DateTimeConversionMethod.Native ) );
+ context.DefaultDateTimeConversionMethod = DateTimeConversionMethod.Native;
}
);
}
@@ -1203,7 +1237,7 @@ public void TestEmptyBytes()
[Test]
public void TestEmptyBytes_Classic()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.Classic );
+ var context = NewSerializationContext( PackerCompatibilityOptions.Classic, DateTimeConversionMethod.Native );
var serializer = this.CreateTarget( context );
using ( var stream = new MemoryStream() )
{
@@ -4104,7 +4138,7 @@ public void TestFullPackableUnpackable_PackToMessageAndUnpackFromMessageUsed()
[Test]
public void TestBinary_ClassicContext()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.Classic );
+ var context = NewSerializationContext( PackerCompatibilityOptions.Classic, DateTimeConversionMethod.Native );
var serializer = context.GetSerializer();
using ( var stream = new MemoryStream() )
@@ -4117,7 +4151,7 @@ public void TestBinary_ClassicContext()
[Test]
public void TestBinary_ContextWithPackerCompatilibyOptionsNone()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext( PackerCompatibilityOptions.None, DateTimeConversionMethod.Timestamp );
var serializer = CreateTarget( context );
using ( var stream = new MemoryStream() )
@@ -4129,8 +4163,8 @@ public void TestBinary_ContextWithPackerCompatilibyOptionsNone()
[Test]
public void TestExt_ClassicContext()
{
- var context = NewSerializationContext( SerializationContext.CreateClassicContext().CompatibilityOptions.PackerCompatibilityOptions );
- context.Serializers.Register( new CustomDateTimeSerealizer() );
+ var context = NewSerializationContext( SerializationContext.CreateClassicContext().CompatibilityOptions.PackerCompatibilityOptions, SerializationContext.CreateClassicContext().DefaultDateTimeConversionMethod );
+ context.Serializers.RegisterOverride( new CustomDateTimeSerealizer() );
var serializer = CreateTarget( context );
using ( var stream = new MemoryStream() )
@@ -4146,7 +4180,7 @@ public void TestExt_ClassicContext()
[Test]
public void TestExt_DefaultContext()
{
- var context = NewSerializationContext( SerializationContext.Default.CompatibilityOptions.PackerCompatibilityOptions );
+ var context = NewSerializationContext( SerializationContext.Default.CompatibilityOptions.PackerCompatibilityOptions, SerializationContext.Default.DefaultDateTimeConversionMethod );
context.Serializers.Register( new CustomDateTimeSerealizer() );
var serializer = CreateTarget( context );
@@ -4163,7 +4197,7 @@ public void TestExt_DefaultContext()
[Test]
public void TestExt_ContextWithPackerCompatilibyOptionsNone()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
context.Serializers.Register( new CustomDateTimeSerealizer() );
context.CompatibilityOptions.PackerCompatibilityOptions = PackerCompatibilityOptions.None;
var serializer = CreateTarget( context );
@@ -4181,7 +4215,7 @@ public void TestExt_ContextWithPackerCompatilibyOptionsNone()
[Test]
public void TestAbstractTypes_KnownCollections_Default_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var serializer = CreateTarget( context );
using ( var stream = new MemoryStream() )
@@ -4199,7 +4233,7 @@ public void TestAbstractTypes_KnownCollections_Default_Success()
[Test]
public void TestAbstractTypes_KnownCollections_WithoutRegistration_Fail()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
context.DefaultCollectionTypes.Unregister( typeof( IList<> ) );
Assert.Throws( () => DoKnownCollectionTest( context ) );
}
@@ -4207,7 +4241,7 @@ public void TestAbstractTypes_KnownCollections_WithoutRegistration_Fail()
[Test]
public void TestAbstractTypes_KnownCollections_ExplicitRegistration_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
context.DefaultCollectionTypes.Register( typeof( IList<> ), typeof( Collection<> ) );
var serializer = CreateTarget( context );
@@ -4226,7 +4260,7 @@ public void TestAbstractTypes_KnownCollections_ExplicitRegistration_Success()
[Test]
public void TestAbstractTypes_KnownCollections_ExplicitRegistrationForSpecific_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
context.DefaultCollectionTypes.Register( typeof( IList ), typeof( Collection ) );
var serializer1 = CreateTarget( context );
@@ -4259,7 +4293,7 @@ public void TestAbstractTypes_KnownCollections_ExplicitRegistrationForSpecific_S
[Test]
public void TestAbstractTypes_NotACollection_Fail()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
Assert.Throws( () => DoKnownCollectionTest( context ) );
}
@@ -4341,7 +4375,7 @@ private static void TestCollectionInterfaceCore( byte[] data, Action asser
{
using ( var buffer = new MemoryStream(data) )
{
- var serializer = MessagePackSerializer.Get( NewSerializationContext( PackerCompatibilityOptions.None ) );
+ var serializer = MessagePackSerializer.Get( NewSerializationContext() );
var result = serializer.Unpack( buffer );
assertion( result );
}
@@ -7750,7 +7784,7 @@ public class ExclusionAndInclusionSimulatously
[Test]
public void TestGenericDerived_Value_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target =
new GenericValueClass
{
@@ -7777,7 +7811,7 @@ public void TestGenericDerived_Value_Success()
[Test]
public void TestGenericDerived_Reference_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target =
new GenericReferenceClass
{
@@ -7804,7 +7838,7 @@ public void TestGenericDerived_Reference_Success()
[Test]
public void TestGenericRecordDerived_Value_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target =
new GenericRecordValueClass( 1, 2 );
var serializer = context.GetSerializer();
@@ -7823,7 +7857,7 @@ public void TestGenericRecordDerived_Value_Success()
[Test]
public void TestGenericRecordDerived_Reference_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target =
new GenericRecordReferenceClass( "1", "2" );
var serializer = context.GetSerializer();
@@ -7847,7 +7881,7 @@ public void TestGenericRecordDerived_Reference_Success()
[Test]
public void TestNullable_Primitive_NonNull_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = DateTime.UtcNow.Millisecond;
var serializer = MessagePackSerializer.CreateInternal( context, null );
@@ -7863,7 +7897,7 @@ public void TestNullable_Primitive_NonNull_Success()
[Test]
public void TestNullable_Primitive_Null_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = default( int? );
var serializer = MessagePackSerializer.CreateInternal( context, null );
@@ -7879,7 +7913,7 @@ public void TestNullable_Primitive_Null_Success()
[Test]
public void TestNullable_Complex_NonNull_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = TimeSpan.FromSeconds( DateTime.UtcNow.Millisecond );
var serializer = MessagePackSerializer.CreateInternal( context, null );
@@ -7895,7 +7929,7 @@ public void TestNullable_Complex_NonNull_Success()
[Test]
public void TestNullable_Complex_Null_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = default( TimeSpan? );
var serializer = MessagePackSerializer.CreateInternal( context, null );
@@ -7911,7 +7945,7 @@ public void TestNullable_Complex_Null_Success()
[Test]
public void TestNullable_Enum_NonNull_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = DayOfWeek.Monday;
var serializer = MessagePackSerializer.CreateInternal( context, null );
@@ -7927,7 +7961,7 @@ public void TestNullable_Enum_NonNull_Success()
[Test]
public void TestNullable_Enum_Null_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = default( DayOfWeek? );
var serializer = MessagePackSerializer.CreateInternal( context, null );
@@ -8936,11 +8970,13 @@ public void TestToFromMessagePackObject_Complex()
Assert.That( asList[ 1 ].IsTypeOf().Value );
Assert.That( asList[ 1 ].AsBinary(), Is.EqualTo( target.Data ) );
- Assert.That( asList[ 2 ].IsTypeOf().Value );
- Assert.That( asList[ 2 ].AsInt64(), Is.EqualTo( target.TimeStamp.ToBinary() ) );
+ Assert.That( asList[ 2 ].IsTypeOf().Value );
+ var timestamp = asList[ 2 ].AsTimestamp();
+ Assert.That( timestamp.ToDateTime(), Is.EqualTo( target.TimeStamp.ToUniversalTime() ) );
Assert.That( asList[ 3 ].IsDictionary );
- Assert.That( asList[ 3 ].AsDictionary().Single().Key.AsInt64(), Is.EqualTo( target.History.Single().Key.ToBinary() ) );
+ var historyKey = asList[ 3 ].AsDictionary().Single().Key.AsTimestamp();
+ Assert.That( historyKey.ToDateTime(), Is.EqualTo( target.History.Single().Key.ToUniversalTime() ) );
Assert.That( asList[ 3 ].AsDictionary().Single().Value.AsString(), Is.EqualTo( target.History.Single().Value ) );
Assert.That( asList[ 4 ].IsArray );
@@ -9371,7 +9407,7 @@ public void TestNoMembers_Fail()
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_ReferenceReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -9397,7 +9433,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceReadWriteProperty
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ReferenceReadWritePropertyAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_ReferenceReadWritePropertyAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -9422,7 +9458,7 @@ public void TestPolymorphicMemberTypeKnownType_ReferenceReadWritePropertyAsObjec
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_ReferenceReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -9448,7 +9484,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceReadWriteField_Su
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ReferenceReadWriteFieldAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_ReferenceReadWriteFieldAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -9473,7 +9509,7 @@ public void TestPolymorphicMemberTypeKnownType_ReferenceReadWriteFieldAsObject_A
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_ReferenceGetOnlyPropertyAndConstructor( new Version( 1, 2, 3, 4 ) );
var serializer = context.GetSerializer();
@@ -9499,7 +9535,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceGetOnlyPropertyAn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ReferenceGetOnlyPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_ReferenceGetOnlyPropertyAndConstructorAsObject( new Version( 1, 2, 3, 4 ) );
var serializer = context.GetSerializer();
@@ -9524,7 +9560,7 @@ public void TestPolymorphicMemberTypeKnownType_ReferenceGetOnlyPropertyAndConstr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ReferencePrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_ReferencePrivateSetterPropertyAndConstructor( new Version( 1, 2, 3, 4 ) );
var serializer = context.GetSerializer();
@@ -9550,7 +9586,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ReferencePrivateSetterProp
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ReferencePrivateSetterPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_ReferencePrivateSetterPropertyAndConstructorAsObject( new Version( 1, 2, 3, 4 ) );
var serializer = context.GetSerializer();
@@ -9575,7 +9611,7 @@ public void TestPolymorphicMemberTypeKnownType_ReferencePrivateSetterPropertyAnd
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_ReferenceReadOnlyFieldAndConstructor( new Version( 1, 2, 3, 4 ) );
var serializer = context.GetSerializer();
@@ -9601,7 +9637,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ReferenceReadOnlyFieldAndC
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ReferenceReadOnlyFieldAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_ReferenceReadOnlyFieldAndConstructorAsObject( new Version( 1, 2, 3, 4 ) );
var serializer = context.GetSerializer();
@@ -9626,7 +9662,7 @@ public void TestPolymorphicMemberTypeKnownType_ReferenceReadOnlyFieldAndConstruc
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ValueReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_ValueReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -9652,7 +9688,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ValueReadWriteProperty_Suc
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ValueReadWritePropertyAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_ValueReadWritePropertyAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -9677,7 +9713,7 @@ public void TestPolymorphicMemberTypeKnownType_ValueReadWritePropertyAsObject_As
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ValueReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_ValueReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -9703,7 +9739,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ValueReadWriteField_Succes
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ValueReadWriteFieldAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_ValueReadWriteFieldAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -9728,7 +9764,7 @@ public void TestPolymorphicMemberTypeKnownType_ValueReadWriteFieldAsObject_AsMpo
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ValueGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_ValueGetOnlyPropertyAndConstructor( new DateTime( 1982, 1, 29, 15, 46, 12, DateTimeKind.Utc ) );
var serializer = context.GetSerializer();
@@ -9754,7 +9790,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ValueGetOnlyPropertyAndCon
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ValueGetOnlyPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_ValueGetOnlyPropertyAndConstructorAsObject( new DateTime( 1982, 1, 29, 15, 46, 12, DateTimeKind.Utc ) );
var serializer = context.GetSerializer();
@@ -9779,7 +9815,7 @@ public void TestPolymorphicMemberTypeKnownType_ValueGetOnlyPropertyAndConstructo
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ValuePrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_ValuePrivateSetterPropertyAndConstructor( new DateTime( 1982, 1, 29, 15, 46, 12, DateTimeKind.Utc ) );
var serializer = context.GetSerializer();
@@ -9805,7 +9841,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ValuePrivateSetterProperty
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ValuePrivateSetterPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_ValuePrivateSetterPropertyAndConstructorAsObject( new DateTime( 1982, 1, 29, 15, 46, 12, DateTimeKind.Utc ) );
var serializer = context.GetSerializer();
@@ -9830,7 +9866,7 @@ public void TestPolymorphicMemberTypeKnownType_ValuePrivateSetterPropertyAndCons
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_ValueReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_ValueReadOnlyFieldAndConstructor( new DateTime( 1982, 1, 29, 15, 46, 12, DateTimeKind.Utc ) );
var serializer = context.GetSerializer();
@@ -9856,7 +9892,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_ValueReadOnlyFieldAndConst
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_ValueReadOnlyFieldAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_ValueReadOnlyFieldAndConstructorAsObject( new DateTime( 1982, 1, 29, 15, 46, 12, DateTimeKind.Utc ) );
var serializer = context.GetSerializer();
@@ -9881,7 +9917,7 @@ public void TestPolymorphicMemberTypeKnownType_ValueReadOnlyFieldAndConstructorA
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_PrimitiveReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -9907,7 +9943,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveReadWriteProperty
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PrimitiveReadWritePropertyAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_PrimitiveReadWritePropertyAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -9932,7 +9968,7 @@ public void TestPolymorphicMemberTypeKnownType_PrimitiveReadWritePropertyAsObjec
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_PrimitiveReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -9958,7 +9994,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveReadWriteField_Su
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PrimitiveReadWriteFieldAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_PrimitiveReadWriteFieldAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -9983,7 +10019,7 @@ public void TestPolymorphicMemberTypeKnownType_PrimitiveReadWriteFieldAsObject_A
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_PrimitiveGetOnlyPropertyAndConstructor( 123 );
var serializer = context.GetSerializer();
@@ -10009,7 +10045,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveGetOnlyPropertyAn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PrimitiveGetOnlyPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_PrimitiveGetOnlyPropertyAndConstructorAsObject( 123 );
var serializer = context.GetSerializer();
@@ -10034,7 +10070,7 @@ public void TestPolymorphicMemberTypeKnownType_PrimitiveGetOnlyPropertyAndConstr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PrimitivePrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_PrimitivePrivateSetterPropertyAndConstructor( 123 );
var serializer = context.GetSerializer();
@@ -10060,7 +10096,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PrimitivePrivateSetterProp
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PrimitivePrivateSetterPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_PrimitivePrivateSetterPropertyAndConstructorAsObject( 123 );
var serializer = context.GetSerializer();
@@ -10085,7 +10121,7 @@ public void TestPolymorphicMemberTypeKnownType_PrimitivePrivateSetterPropertyAnd
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_PrimitiveReadOnlyFieldAndConstructor( 123 );
var serializer = context.GetSerializer();
@@ -10111,7 +10147,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PrimitiveReadOnlyFieldAndC
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PrimitiveReadOnlyFieldAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_PrimitiveReadOnlyFieldAndConstructorAsObject( 123 );
var serializer = context.GetSerializer();
@@ -10136,7 +10172,7 @@ public void TestPolymorphicMemberTypeKnownType_PrimitiveReadOnlyFieldAndConstruc
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_StringReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_StringReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10162,7 +10198,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_StringReadWriteProperty_Su
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_StringReadWritePropertyAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_StringReadWritePropertyAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -10187,7 +10223,7 @@ public void TestPolymorphicMemberTypeKnownType_StringReadWritePropertyAsObject_A
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_StringReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_StringReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -10213,7 +10249,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_StringReadWriteField_Succe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_StringReadWriteFieldAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_StringReadWriteFieldAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -10238,7 +10274,7 @@ public void TestPolymorphicMemberTypeKnownType_StringReadWriteFieldAsObject_AsMp
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_StringGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_StringGetOnlyPropertyAndConstructor( "ABC" );
var serializer = context.GetSerializer();
@@ -10264,7 +10300,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_StringGetOnlyPropertyAndCo
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_StringGetOnlyPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_StringGetOnlyPropertyAndConstructorAsObject( "ABC" );
var serializer = context.GetSerializer();
@@ -10289,7 +10325,7 @@ public void TestPolymorphicMemberTypeKnownType_StringGetOnlyPropertyAndConstruct
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_StringPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_StringPrivateSetterPropertyAndConstructor( "ABC" );
var serializer = context.GetSerializer();
@@ -10315,7 +10351,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_StringPrivateSetterPropert
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_StringPrivateSetterPropertyAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_StringPrivateSetterPropertyAndConstructorAsObject( "ABC" );
var serializer = context.GetSerializer();
@@ -10340,7 +10376,7 @@ public void TestPolymorphicMemberTypeKnownType_StringPrivateSetterPropertyAndCon
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_StringReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_StringReadOnlyFieldAndConstructor( "ABC" );
var serializer = context.GetSerializer();
@@ -10366,7 +10402,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_StringReadOnlyFieldAndCons
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_StringReadOnlyFieldAndConstructorAsObject_AsMpo()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_StringReadOnlyFieldAndConstructorAsObject( "ABC" );
var serializer = context.GetSerializer();
@@ -10391,7 +10427,7 @@ public void TestPolymorphicMemberTypeKnownType_StringReadOnlyFieldAndConstructor
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_PolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10417,7 +10453,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicReadWriteProper
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PolymorphicReadWritePropertyAsObject_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_PolymorphicReadWritePropertyAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -10443,7 +10479,7 @@ public void TestPolymorphicMemberTypeKnownType_PolymorphicReadWritePropertyAsObj
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Normal_PolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -10469,7 +10505,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicReadWriteField_
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PolymorphicReadWriteFieldAsObject_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_PolymorphicReadWriteFieldAsObject.Initialize();
var serializer = context.GetSerializer();
@@ -10495,7 +10531,7 @@ public void TestPolymorphicMemberTypeKnownType_PolymorphicReadWriteFieldAsObject
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_PolymorphicGetOnlyPropertyAndConstructor( new FileEntry { Name = "file", Size = 1 } );
var serializer = context.GetSerializer();
@@ -10521,7 +10557,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicGetOnlyProperty
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PolymorphicGetOnlyPropertyAndConstructorAsObject_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_PolymorphicGetOnlyPropertyAndConstructorAsObject( new FileEntry { Name = "file", Size = 1 } );
var serializer = context.GetSerializer();
@@ -10547,7 +10583,7 @@ public void TestPolymorphicMemberTypeKnownType_PolymorphicGetOnlyPropertyAndCons
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_PolymorphicPrivateSetterPropertyAndConstructor( new FileEntry { Name = "file", Size = 1 } );
var serializer = context.GetSerializer();
@@ -10573,7 +10609,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicPrivateSetterPr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PolymorphicPrivateSetterPropertyAndConstructorAsObject_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_PolymorphicPrivateSetterPropertyAndConstructorAsObject( new FileEntry { Name = "file", Size = 1 } );
var serializer = context.GetSerializer();
@@ -10599,7 +10635,7 @@ public void TestPolymorphicMemberTypeKnownType_PolymorphicPrivateSetterPropertyA
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Normal_PolymorphicReadOnlyFieldAndConstructor( new FileEntry { Name = "file", Size = 1 } );
var serializer = context.GetSerializer();
@@ -10625,7 +10661,7 @@ public void TestPolymorphicMemberTypeKnownType_Normal_PolymorphicReadOnlyFieldAn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_PolymorphicReadOnlyFieldAndConstructorAsObject_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_PolymorphicReadOnlyFieldAndConstructorAsObject( new FileEntry { Name = "file", Size = 1 } );
var serializer = context.GetSerializer();
@@ -10654,7 +10690,7 @@ public void TestPolymorphicMemberTypeKnownType_PolymorphicReadOnlyFieldAndConstr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListStaticItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10680,7 +10716,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemReadWritePrope
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListStaticItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -10706,7 +10742,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemReadWriteField
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListStaticItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10732,7 +10768,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemGetOnlyCollect
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListStaticItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10758,7 +10794,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemPrivateSetterC
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListStaticItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -10784,7 +10820,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListStaticItemReadOnlyCollec
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10810,7 +10846,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadWrite
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -10836,7 +10872,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadWrite
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10862,7 +10898,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemGetOnlyCo
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10888,7 +10924,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemPrivateSe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -10914,7 +10950,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadOnlyC
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10940,7 +10976,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemReadWritePrope
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -10966,7 +11002,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemReadWriteField
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -10992,7 +11028,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemGetOnlyCollect
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11018,7 +11054,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemPrivateSetterC
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11044,7 +11080,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItemReadOnlyCollec
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11070,7 +11106,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11096,7 +11132,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItselfGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11122,7 +11158,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfGetOnly
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItselfPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11148,7 +11184,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfPrivate
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11174,7 +11210,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListPolymorphicItselfReadOnl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItselfReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11200,7 +11236,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfReadWritePro
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItselfReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11226,7 +11262,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfReadWriteFie
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfGetOnlyCollectionProperty_Fail()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItselfGetOnlyCollectionProperty.Initialize();
Assert.Throws( () => context.GetSerializer() );
}
@@ -11240,7 +11276,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfGetOnlyColle
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItselfPrivateSetterCollectionProperty.Initialize();
#if SILVERLIGHT && !SILVERLIGHT_PRIVILEGED
Assert.Throws( () => context.GetSerializer() );
@@ -11270,7 +11306,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfPrivateSette
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfReadOnlyCollectionField_Fail()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_List_ListObjectItselfReadOnlyCollectionField.Initialize();
Assert.Throws( () => context.GetSerializer() );
}
@@ -11287,7 +11323,7 @@ public void TestPolymorphicMemberTypeKnownType_List_ListObjectItselfReadOnlyColl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11313,7 +11349,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11339,7 +11375,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11365,7 +11401,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemGe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11391,7 +11427,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemPr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11417,7 +11453,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11443,7 +11479,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11469,7 +11505,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11495,7 +11531,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11521,7 +11557,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11547,7 +11583,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndStaticI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11573,7 +11609,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11599,7 +11635,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11625,7 +11661,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemGe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11651,7 +11687,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemPr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11677,7 +11713,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndStaticItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11703,7 +11739,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11729,7 +11765,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11755,7 +11791,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11781,7 +11817,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11807,7 +11843,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndPolymorphicI
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11833,7 +11869,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11859,7 +11895,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11885,7 +11921,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemGe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11911,7 +11947,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemPr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -11937,7 +11973,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemRe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -11963,7 +11999,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemRea
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -11989,7 +12025,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemRea
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12015,7 +12051,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemGet
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12041,7 +12077,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemPri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -12067,7 +12103,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicKeyAndItemRea
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12093,7 +12129,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadWrit
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12119,7 +12155,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadWrit
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12145,7 +12181,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemGetOnlyC
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12171,7 +12207,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemPrivateS
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -12197,7 +12233,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectKeyAndItemReadOnly
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12223,7 +12259,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12249,7 +12285,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfGetOnlyCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfGetOnlyCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12275,7 +12311,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfGetOnly
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfPrivateSetterCollectionProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12301,7 +12337,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfPrivate
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadOnlyCollectionField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadOnlyCollectionField.Initialize();
var serializer = context.GetSerializer();
@@ -12327,7 +12363,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfReadOnl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12353,7 +12389,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadWritePro
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12379,7 +12415,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadWriteFie
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfGetOnlyCollectionProperty_Fail()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectItselfGetOnlyCollectionProperty.Initialize();
Assert.Throws( () => context.GetSerializer() );
}
@@ -12393,7 +12429,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfGetOnlyColle
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfPrivateSetterCollectionProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectItselfPrivateSetterCollectionProperty.Initialize();
#if SILVERLIGHT && !SILVERLIGHT_PRIVILEGED
Assert.Throws( () => context.GetSerializer() );
@@ -12423,7 +12459,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfPrivateSette
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadOnlyCollectionField_Fail()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadOnlyCollectionField.Initialize();
Assert.Throws( () => context.GetSerializer() );
}
@@ -12441,7 +12477,7 @@ public void TestPolymorphicMemberTypeKnownType_Dict_DictObjectItselfReadOnlyColl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12467,7 +12503,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadWriteProper
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12493,7 +12529,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadWriteField_
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1StaticGetOnlyPropertyAndConstructor( Tuple.Create( "1" ) );
var serializer = context.GetSerializer();
@@ -12519,7 +12555,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticGetOnlyProperty
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1StaticPrivateSetterPropertyAndConstructor( Tuple.Create( "1" ) );
var serializer = context.GetSerializer();
@@ -12545,7 +12581,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticPrivateSetterPr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadOnlyFieldAndConstructor( Tuple.Create( "1" ) );
var serializer = context.GetSerializer();
@@ -12571,7 +12607,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1StaticReadOnlyFieldAn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12597,7 +12633,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadWriteP
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12623,7 +12659,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadWriteF
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -12649,7 +12685,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicGetOnlyPro
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicPrivateSetterPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -12675,7 +12711,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicPrivateSet
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadOnlyFieldAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -12701,7 +12737,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1PolymorphicReadOnlyFi
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12727,7 +12763,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWritePr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12753,7 +12789,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteFi
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemGetOnlyPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as object ) );
var serializer = context.GetSerializer();
@@ -12779,7 +12815,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemGetOnlyProp
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemPrivateSetterPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as object ) );
var serializer = context.GetSerializer();
@@ -12805,7 +12841,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemPrivateSett
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadOnlyFieldAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as object ) );
var serializer = context.GetSerializer();
@@ -12831,7 +12867,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadOnlyFie
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12857,7 +12893,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadWrite
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -12883,7 +12919,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadWrite
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfGetOnlyPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileEntry ) );
var serializer = context.GetSerializer();
@@ -12909,7 +12945,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfGetOnlyPr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfPrivateSetterPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileEntry ) );
var serializer = context.GetSerializer();
@@ -12935,7 +12971,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfPrivateSe
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadOnlyFieldAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileEntry ) );
var serializer = context.GetSerializer();
@@ -12961,7 +12997,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItselfReadOnlyF
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -12987,7 +13023,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadWritePro
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13013,7 +13049,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadWriteFie
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticGetOnlyPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7" ) );
var serializer = context.GetSerializer();
@@ -13039,7 +13075,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticGetOnlyPrope
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticPrivateSetterPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7" ) );
var serializer = context.GetSerializer();
@@ -13065,7 +13101,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticPrivateSette
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadOnlyFieldAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7" ) );
var serializer = context.GetSerializer();
@@ -13091,7 +13127,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllStaticReadOnlyFiel
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13117,7 +13153,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadW
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13143,7 +13179,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadW
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, "2", "3", "4", "5", "6", "7") );
var serializer = context.GetSerializer();
@@ -13169,7 +13205,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicGetOn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicPrivateSetterPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, "2", "3", "4", "5", "6", "7") );
var serializer = context.GetSerializer();
@@ -13195,7 +13231,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicPriva
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadOnlyFieldAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, "2", "3", "4", "5", "6", "7") );
var serializer = context.GetSerializer();
@@ -13221,7 +13257,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7FirstPolymorphicReadO
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13247,7 +13283,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadWr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13273,7 +13309,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadWr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", new FileEntry { Name = "7", Size = 7 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13299,7 +13335,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicGetOnl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicPrivateSetterPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", new FileEntry { Name = "7", Size = 7 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13325,7 +13361,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicPrivat
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadOnlyFieldAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", new FileEntry { Name = "7", Size = 7 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13351,7 +13387,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7LastPolymorphicReadOn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13377,7 +13413,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13403,7 +13439,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( "1", "2", "3", new FileEntry { Name = "4", Size = 4 } as FileSystemEntry, "5", "6", "7") );
var serializer = context.GetSerializer();
@@ -13429,7 +13465,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicGetOnly
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicPrivateSetterPropertyAndConstructor( Tuple.Create( "1", "2", "3", new FileEntry { Name = "4", Size = 4 } as FileSystemEntry, "5", "6", "7") );
var serializer = context.GetSerializer();
@@ -13455,7 +13491,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicPrivate
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadOnlyFieldAndConstructor( Tuple.Create( "1", "2", "3", new FileEntry { Name = "4", Size = 4 } as FileSystemEntry, "5", "6", "7") );
var serializer = context.GetSerializer();
@@ -13481,7 +13517,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7MidPolymorphicReadOnl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13507,7 +13543,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13533,7 +13569,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, new DirectoryEntry { Name = "2", ChildCount = 2 } as FileSystemEntry, new FileEntry { Name = "3", Size = 3 } as FileSystemEntry, new DirectoryEntry { Name = "4", ChildCount = 4 } as FileSystemEntry, new FileEntry { Name = "5", Size = 5 } as FileSystemEntry, new DirectoryEntry { Name = "6", ChildCount = 6 } as FileSystemEntry, new FileEntry { Name = "7", Size = 7 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13559,7 +13595,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicGetOnly
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicPrivateSetterPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, new DirectoryEntry { Name = "2", ChildCount = 2 } as FileSystemEntry, new FileEntry { Name = "3", Size = 3 } as FileSystemEntry, new DirectoryEntry { Name = "4", ChildCount = 4 } as FileSystemEntry, new FileEntry { Name = "5", Size = 5 } as FileSystemEntry, new DirectoryEntry { Name = "6", ChildCount = 6 } as FileSystemEntry, new FileEntry { Name = "7", Size = 7 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13585,7 +13621,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicPrivate
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadOnlyFieldAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, new DirectoryEntry { Name = "2", ChildCount = 2 } as FileSystemEntry, new FileEntry { Name = "3", Size = 3 } as FileSystemEntry, new DirectoryEntry { Name = "4", ChildCount = 4 } as FileSystemEntry, new FileEntry { Name = "5", Size = 5 } as FileSystemEntry, new DirectoryEntry { Name = "6", ChildCount = 6 } as FileSystemEntry, new FileEntry { Name = "7", Size = 7 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13611,7 +13647,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple7AllPolymorphicReadOnl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13637,7 +13673,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadWritePro
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13663,7 +13699,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadWriteFie
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticGetOnlyPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7", "8" ) );
var serializer = context.GetSerializer();
@@ -13689,7 +13725,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticGetOnlyPrope
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticPrivateSetterPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7", "8" ) );
var serializer = context.GetSerializer();
@@ -13715,7 +13751,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticPrivateSette
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadOnlyFieldAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7", "8" ) );
var serializer = context.GetSerializer();
@@ -13741,7 +13777,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllStaticReadOnlyFiel
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13767,7 +13803,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadWr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13793,7 +13829,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadWr
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7", new FileEntry { Name = "8", Size = 8 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13819,7 +13855,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicGetOnl
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicPrivateSetterPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicPrivateSetterPropertyAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7", new FileEntry { Name = "8", Size = 8 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13845,7 +13881,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicPrivat
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadOnlyFieldAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadOnlyFieldAndConstructor( Tuple.Create( "1", "2", "3", "4", "5", "6", "7", new FileEntry { Name = "8", Size = 8 } as FileSystemEntry ) );
var serializer = context.GetSerializer();
@@ -13871,7 +13907,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8LastPolymorphicReadOn
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicReadWriteProperty_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicReadWriteProperty.Initialize();
var serializer = context.GetSerializer();
@@ -13897,7 +13933,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicReadWriteField_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = PolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicReadWriteField.Initialize();
var serializer = context.GetSerializer();
@@ -13923,7 +13959,7 @@ public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicReadWri
[Category( "PolymorphicSerialization" )]
public void TestPolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicGetOnlyPropertyAndConstructor_Success()
{
- var context = NewSerializationContext( PackerCompatibilityOptions.None );
+ var context = NewSerializationContext();
var target = new PolymorphicMemberTypeKnownType_Tuple_Tuple8AllPolymorphicGetOnlyPropertyAndConstructor( Tuple.Create( new FileEntry { Name = "1", Size = 1 } as FileSystemEntry, new DirectoryEntry { Name = "2", ChildCount = 2 } as FileSystemEntry, new FileEntry { Name = "3", Size = 3 } as FileSystemEntry, new DirectoryEntry { Name = "4", ChildCount = 4 } as FileSystemEntry, new FileEntry { Name = "5", Size = 5 } as FileSystemEntry, new DirectoryEntry { Name = "6", ChildCount = 6 } as FileSystemEntry, new FileEntry { Name = "7", Size = 7 } as FileSystemEntry, new DirectoryEntry { Name = "8", ChildCount = 8 } as FileSystemEntry ) );
var serializer = context.GetSerializer