示例#1
0
        private object SerializeArgument(object x)
        {
            if (x is string || x is long || x is int)
            {
                return(x);
            }

            IWampFormatter <TMessage> formatter = mBinding.Formatter;

            if (x is object[] array)
            {
                TMessage[] arguments =
                    array.Select(y => formatter.Serialize(y)).ToArray();

                return(arguments);
            }

            return(formatter.Serialize(x));
        }
示例#2
0
        private object SerializeArgument(object x)
        {
            if (x is string || x is long || x is int)
            {
                return x;
            }

            IWampFormatter<TMessage> formatter = mBinding.Formatter;
            object[] array = x as object[];
            
            if (array != null)
            {
                TMessage[] arguments = 
                    array.Select(y => formatter.Serialize(y)).ToArray();
                
                return arguments;
            }

            return formatter.Serialize(x);
        }
        public static WampMessage <TMessage> SerializeMessage <TMessage>(this IWampFormatter <TMessage> formatter, WampMessage <object> message)
        {
            WampMessage <TMessage> result = new WampMessage <TMessage>();

            result.MessageType = message.MessageType;

            result.Arguments =
                message.Arguments.Select(x => formatter.Serialize(x))
                .ToArray();

            return(result);
        }
示例#4
0
 public WampCalleeInvocationHandler(IWampFormatter <TMessage> formatter)
 {
     mFormatter    = formatter;
     mEmptyDetails = mFormatter.Serialize(new Dictionary <string, string>());
 }