Ejemplo n.º 1
0
        public static RequestMessage DeserializeRequestOrNotification( IEnumerable<byte> input )
        {
            RequestMessage result;
            var error =
                new RequestMessageSerializer(
                        Arrays<IFilterProvider<RequestMessageSerializationFilter>>.Empty,
                        Arrays<IFilterProvider<SerializedMessageFilter<MessageSerializationContext>>>.Empty,
                        Arrays<IFilterProvider<SerializedMessageFilter<MessageDeserializationContext>>>.Empty,
                        Arrays<IFilterProvider<RequestMessageDeserializationFilter>>.Empty,
                        null
                ).Deserialize( input, out result );
            if ( !error.IsSuccess )
            {
                throw error.ToException();
            }

            return result;
        }
Ejemplo n.º 2
0
        public static RpcOutputBuffer SerializeRequest( int messageId, String method, params object[] arguments )
        {
            RpcOutputBuffer result = new RpcOutputBuffer( ChunkBuffer.CreateDefault() );
            var error =
                new RequestMessageSerializer(
                        Arrays<IFilterProvider<RequestMessageSerializationFilter>>.Empty,
                        Arrays<IFilterProvider<SerializedMessageFilter<MessageSerializationContext>>>.Empty,
                        Arrays<IFilterProvider<SerializedMessageFilter<MessageDeserializationContext>>>.Empty,
                        Arrays<IFilterProvider<RequestMessageDeserializationFilter>>.Empty,
                        null
                ).Serialize( messageId, method, arguments, result );
            if ( !error.IsSuccess )
            {
                throw error.ToException();
            }

            return result;
        }