Beispiel #1
0
        protected virtual object OnDecode(byte[] data, Type type)
        {
            if (data == null || data.Length == 0)
            {
                return(null);
            }
            if (type == typeof(InvokeMessage))
            {
                var item = _serializer.Deserialize <TInvoke>(data);
                return(item.GetValue());
            }

            if (type == typeof(MessageResult))
            {
                var item = _serializer.Deserialize <TResult>(data);
                return(item.GetValue());
            }

            return(_serializer.DeserializeNoType(data, type));
        }