protected internal override void UnpackToCore(MsgPack.Unpacker unpacker, MsgPack.Serialization.StringKeyedCollection <MsgPack.MessagePackObject> collection)
        {
            if ((unpacker.IsArrayHeader == false))
            {
                throw MsgPack.Serialization.SerializationExceptions.NewIsNotArrayHeader();
            }
            int count = default(int);

            count = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
            for (int i = 0; (i < count); i = (i + 1))
            {
                MsgPack.MessagePackObject nullable = default(MsgPack.MessagePackObject);
                if ((unpacker.Read() == false))
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                }
                if (((unpacker.IsArrayHeader == false) &&
                     (unpacker.IsMapHeader == false)))
                {
                    nullable = unpacker.LastReadData;
                }
                else
                {
                    nullable = unpacker.UnpackSubtreeData();
                }
                if ((nullable.IsNil == false))
                {
                    collection.Add(nullable);
                }
                else
                {
                    collection.Add(nullable);
                }
            }
        }
        protected internal override void UnpackToCore(MsgPack.Unpacker unpacker, MsgPack.Serialization.StringKeyedCollection <int> collection)
        {
            if ((unpacker.IsArrayHeader == false))
            {
                throw MsgPack.Serialization.SerializationExceptions.NewIsNotArrayHeader();
            }
            int count = default(int);

            count = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
            for (int i = 0; (i < count); i = (i + 1))
            {
                System.Nullable <int> nullable = default(System.Nullable <int>);
                nullable = MsgPack.Serialization.UnpackHelpers.UnpackNullableInt32Value(unpacker, typeof(MsgPack.Serialization.StringKeyedCollection <int>), string.Format(System.Globalization.CultureInfo.InvariantCulture, "item{0}", new object[] {
                    ((object)(i))
                }));
                if (nullable.HasValue)
                {
                    collection.Add(nullable.Value);
                }
                else
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewValueTypeCannotBeNull(string.Format(System.Globalization.CultureInfo.InvariantCulture, "item{0}", new object[] {
                        ((object)(i))
                    }), typeof(int), typeof(MsgPack.Serialization.StringKeyedCollection <int>));
                }
            }
        }
Example #3
0
        protected internal override void UnpackToCore(MsgPack.Unpacker unpacker, MsgPack.Serialization.StringKeyedCollection <object> collection)
        {
            if ((unpacker.IsArrayHeader == false))
            {
                throw MsgPack.Serialization.SerializationExceptions.NewIsNotArrayHeader();
            }
            int count = default(int);

            count = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
            for (int i = 0; (i < count); i = (i + 1))
            {
                object nullable = default(object);
                if ((unpacker.Read() == false))
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                }
                if (((unpacker.IsArrayHeader == false) &&
                     (unpacker.IsMapHeader == false)))
                {
                    nullable = this._serializer0.UnpackFrom(unpacker);
                }
                else
                {
                    MsgPack.Unpacker disposable = default(MsgPack.Unpacker);
                    disposable = unpacker.ReadSubtree();
                    try {
                        nullable = this._serializer0.UnpackFrom(disposable);
                    }
                    finally {
                        if (((disposable == null)
                             == false))
                        {
                            disposable.Dispose();
                        }
                    }
                }
                if (((nullable == null)
                     == false))
                {
                    collection.Add(nullable);
                }
                else
                {
                    collection.Add(nullable);
                }
            }
        }
Example #4
0
        protected internal override void UnpackToCore(MsgPack.Unpacker unpacker, MsgPack.Serialization.StringKeyedCollection <System.DateTime> collection)
        {
            if ((unpacker.IsArrayHeader == false))
            {
                throw MsgPack.Serialization.SerializationExceptions.NewIsNotArrayHeader();
            }
            int count = default(int);

            count = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
            for (int i = 0; (i < count); i = (i + 1))
            {
                System.Nullable <System.DateTime> nullable = default(System.Nullable <System.DateTime>);
                if ((unpacker.Read() == false))
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                }
                if (((unpacker.IsArrayHeader == false) &&
                     (unpacker.IsMapHeader == false)))
                {
                    nullable = this._serializer1.UnpackFrom(unpacker);
                }
                else
                {
                    MsgPack.Unpacker disposable = default(MsgPack.Unpacker);
                    disposable = unpacker.ReadSubtree();
                    try {
                        nullable = this._serializer1.UnpackFrom(disposable);
                    }
                    finally {
                        if (((disposable == null)
                             == false))
                        {
                            disposable.Dispose();
                        }
                    }
                }
                if (nullable.HasValue)
                {
                    collection.Add(nullable.Value);
                }
                else
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewValueTypeCannotBeNull(string.Format(System.Globalization.CultureInfo.InvariantCulture, "item{0}", new object[] {
                        ((object)(i))
                    }), typeof(System.DateTime), typeof(MsgPack.Serialization.StringKeyedCollection <System.DateTime>));
                }
            }
        }