예제 #1
0
        private RawMessage <TRaw> GetFormattedMessage(WampMessage <object> message)
        {
            RawMessage <TRaw> result = message as RawMessage <TRaw>;

            if (result == null)
            {
                result     = new RawMessage <TRaw>(message);
                result.Raw = mParser.Format(message);
            }

            return(result);
        }
예제 #2
0
        private RawMessage <TRaw> GetFormattedMessage(WampMessage <object> message)
        {
            if (!(message is RawMessage <TRaw> result))
            {
                result     = new RawMessage <TRaw>(message);
                result.Raw = mParser.Format(message);

                if (ComputeBytes == true)
                {
                    result.Bytes = mParser.GetBytes(result.Raw);
                }
            }

            return(result);
        }
예제 #3
0
 public static byte[] GetBytes <TMessage, TRaw>(this IWampMessageParser <TMessage, TRaw> parser,
                                                WampMessage <object> message)
 {
     if (message is RawMessage <TRaw> rawMessage &&
         rawMessage.Bytes != null)
     {
         return(rawMessage.Bytes);
     }
     else
     {
         TRaw   raw    = parser.Format(message);
         byte[] binary = parser.GetBytes(raw);
         return(binary);
     }
 }