コード例 #1
0
        public object DeserializeReply(Message message, object[] parameters)
        {
            if (message == null)
            {
                return(null);
            }
            WebContentFormat        format;
            IClientMessageFormatter selectedFormatter;

            if (DemultiplexingDispatchMessageFormatter.TryGetEncodingFormat(message, out format))
            {
                this.formatters.TryGetValue(format, out selectedFormatter);
                if (selectedFormatter == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new InvalidOperationException(SR2.GetString(SR2.UnrecognizedHttpMessageFormat, format, GetSupportedFormats())));
                }
            }
            else
            {
                selectedFormatter = this.defaultFormatter;
                if (selectedFormatter == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new InvalidOperationException(SR2.GetString(SR2.MessageFormatPropertyNotFound3)));
                }
            }
            return(selectedFormatter.DeserializeReply(message, parameters));
        }