Exemplo n.º 1
0
        public override MessageEncoderFactory CreateMessageEncoderFactory()
        {
            TraceTextMessageEncoderFactory factory = new TraceTextMessageEncoderFactory(this.MediaType,
                                                                                        this.Encoding, this.MessageVersion);

            TraceTextMessageEncoder encoder = (TraceTextMessageEncoder)factory.Encoder;

            encoder.AddListeners(_listeners);
            encoder.SetBindingElement(this);
            return(factory);
        }
Exemplo n.º 2
0
        public TraceTextMessageEncoder(TraceTextMessageEncoderFactory factory)
        {
            this.factory = factory;

            this.writerSettings          = new XmlWriterSettings();
            this.writerSettings.Encoding = Encoding.GetEncoding(factory.CharSet);
            this.contentType             = string.Format("{0}; charset={1}",
                                                         this.factory.MediaType, this.writerSettings.Encoding.HeaderName);

            MessageEncoderFactory             baseFactory;
            TextMessageEncodingBindingElement element =
                new TextMessageEncodingBindingElement(factory.MessageVersion, Encoding.GetEncoding(factory.CharSet));

            baseFactory = element.CreateMessageEncoderFactory();

            baseEncoder = baseFactory.Encoder;
        }