private object[] ReadArguments(MsgPackReader reader, string target)
        {
            var subscription = this.Connection.GetSubscription(target);

            object[] args;
            if (subscription == null || subscription.callbacks == null || subscription.callbacks.Count == 0)
            {
                args = reader.ReadValue(typeof(object[])) as object[];
            }
            else
            {
                reader.NextToken();

                if (subscription.callbacks[0].ParamTypes != null)
                {
                    args = new object[subscription.callbacks[0].ParamTypes.Length];
                    for (int i = 0; i < subscription.callbacks[0].ParamTypes.Length; ++i)
                    {
                        args[i] = reader.ReadValue(subscription.callbacks[0].ParamTypes[i]);
                    }
                }
                else
                {
                    args = null;
                }

                reader.NextToken();
            }

            return(args);
        }
        private object ReadItem(MsgPackReader reader, string invocationId)
        {
            long longId = 0;

            if (long.TryParse(invocationId, out longId))
            {
                Type itemType = this.Connection.GetItemType(longId);
                return(reader.ReadValue(itemType));
            }
            else
            {
                return(reader.ReadValue(typeof(object)));
            }
        }
Esempio n. 3
0
        public static object Deserialize(Type objectType, Stream msgPackInput, SerializationContext context)
        {
            if (objectType == null)
            {
                throw new ArgumentNullException("objectType");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (msgPackInput == null)
            {
                throw new ArgumentNullException("msgPackInput");
            }
            if (!msgPackInput.CanRead)
            {
                throw JsonSerializationException.StreamIsNotReadable();
            }

            var reader = new MsgPackReader(msgPackInput, context);

            return(reader.ReadValue(objectType, false));
        }
 private Dictionary <string, string> ReadHeaders(MsgPackReader reader)
 {
     return(reader.ReadValue(typeof(Dictionary <string, string>)) as Dictionary <string, string>);
 }
 private string[] ReadStreamIds(MsgPackReader reader)
 {
     return(reader.ReadValue(typeof(string[])) as string[]);
 }