Beispiel #1
0
        protected override IO.Ably.Message UnpackFromCore(MsgPack.Unpacker unpacker)
        {
            IO.Ably.Message result = default(IO.Ably.Message);
            result = new IO.Ably.Message();
            int itemsCount0 = default(int);

            itemsCount0 = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
            for (int i = 0; (i < itemsCount0); i = (i + 1))
            {
                string key       = default(string);
                string nullable7 = default(string);
                nullable7 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker, typeof(IO.Ably.Message),
                                                                                  "MemberName");
                if (((nullable7 == null)
                     == false))
                {
                    key = nullable7;
                }
                else
                {
                    throw MsgPack.Serialization.SerializationExceptions.NewNullIsProhibited("MemberName");
                }
                if ((key == "timestamp"))
                {
                    System.Nullable <System.DateTimeOffset> nullable15 = default(System.Nullable <System.DateTimeOffset>);
                    if ((unpacker.Read() == false))
                    {
                        throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                    }
                    if (((unpacker.IsArrayHeader == false) &&
                         (unpacker.IsMapHeader == false)))
                    {
                        nullable15 = this._serializer2.UnpackFrom(unpacker);
                    }
                    else
                    {
                        MsgPack.Unpacker disposable4 = default(MsgPack.Unpacker);
                        disposable4 = unpacker.ReadSubtree();
                        try
                        {
                            nullable15 = this._serializer2.UnpackFrom(disposable4);
                        }
                        finally
                        {
                            if (((disposable4 == null)
                                 == false))
                            {
                                disposable4.Dispose();
                            }
                        }
                    }
                    if (nullable15.HasValue)
                    {
                        result.Timestamp = nullable15;
                    }
                }
                else
                {
                    if ((key == "name"))
                    {
                        string nullable14 = default(string);
                        nullable14 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker,
                                                                                           typeof(IO.Ably.Message), "System.String name");
                        if (((nullable14 == null)
                             == false))
                        {
                            result.Name = nullable14;
                        }
                    }
                    else
                    {
                        if ((key == "id"))
                        {
                            string nullable13 = default(string);
                            nullable13 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker,
                                                                                               typeof(IO.Ably.Message), "System.String id");
                            if (((nullable13 == null)
                                 == false))
                            {
                                result.Id = nullable13;
                            }
                        }
                        else
                        {
                            if ((key == "encoding"))
                            {
                                string nullable12 = default(string);
                                nullable12 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker,
                                                                                                   typeof(IO.Ably.Message), "System.String encoding");
                                if (((nullable12 == null)
                                     == false))
                                {
                                    result.Encoding = nullable12;
                                }
                            }
                            else
                            {
                                if ((key == "data"))
                                {
                                    object nullable10 = default(object);
                                    if ((unpacker.Read() == false))
                                    {
                                        throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                                    }
                                    if (((unpacker.IsArrayHeader == false) &&
                                         (unpacker.IsMapHeader == false)))
                                    {
                                        nullable10 = this._serializer1.UnpackFrom(unpacker);
                                    }
                                    else
                                    {
                                        MsgPack.Unpacker disposable2 = default(MsgPack.Unpacker);
                                        disposable2 = unpacker.ReadSubtree();
                                        try
                                        {
                                            nullable10 = this._serializer1.UnpackFrom(disposable2);
                                        }
                                        finally
                                        {
                                            if (((disposable2 == null)
                                                 == false))
                                            {
                                                disposable2.Dispose();
                                            }
                                        }
                                    }
                                    if (((nullable10 == null)
                                         == false))
                                    {
                                        if (nullable10 is MsgPack.MessagePackObject)
                                        {
                                            nullable10 = ((MessagePackObject)nullable10).ToObject();
                                            if (nullable10 is MessagePackObject[])
                                            {
                                                result.Data =
                                                    ((MessagePackObject[])nullable10).Select(x => x.ToObject()).ToArray();
                                            }
                                            else
                                            {
                                                result.Data = nullable10;
                                            }
                                        }
                                        else
                                        {
                                            result.Data = nullable10;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((key == "connectionId"))
                                    {
                                        string nullable9 = default(string);
                                        nullable9 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker,
                                                                                                          typeof(IO.Ably.Message), "System.String connectionId");
                                        if (((nullable9 == null)
                                             == false))
                                        {
                                            result.ConnectionId = nullable9;
                                        }
                                    }
                                    else
                                    {
                                        if ((key == "clientId"))
                                        {
                                            string nullable8 = default(string);
                                            nullable8 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker,
                                                                                                              typeof(IO.Ably.Message), "System.String clientId");
                                            if (((nullable8 == null)
                                                 == false))
                                            {
                                                result.ClientId = nullable8;
                                            }
                                        }
                                        else
                                        {
                                            unpacker.Skip();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }