コード例 #1
0
        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);
        }
コード例 #2
0
        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)));
            }
        }
コード例 #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));
        }
コード例 #4
0
 private Dictionary <string, string> ReadHeaders(MsgPackReader reader)
 {
     return(reader.ReadValue(typeof(Dictionary <string, string>)) as Dictionary <string, string>);
 }
コード例 #5
0
 private string[] ReadStreamIds(MsgPackReader reader)
 {
     return(reader.ReadValue(typeof(string[])) as string[]);
 }