本文整理汇总了C#中MessageEncoder类的典型用法代码示例。如果您正苦于以下问题:C# MessageEncoder类的具体用法?C# MessageEncoder怎么用?C# MessageEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageEncoder类属于命名空间,在下文中一共展示了MessageEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConverterMessageDeliveryReader
public ConverterMessageDeliveryReader(ContractDescription[] contracts, Stream stream, bool isOwner, MessageEncoder encoder, int maxSizeOfHeaders)
: base(stream, isOwner)
{
MaxSizeOfHeaders = maxSizeOfHeaders;
Encoder = encoder;
_contracts = contracts;
}
示例2: GZipMessageEncoder
//We require an inner encoder to be supplied (see comment above)
internal GZipMessageEncoder(MessageEncoder messageEncoder)
: base()
{
if (messageEncoder == null)
throw new ArgumentNullException("messageEncoder", "A valid message encoder must be passed to the GZipEncoder");
innerEncoder = messageEncoder;
}
示例3: CustomTextMessageEncoderFactory
internal CustomTextMessageEncoderFactory( string mediaType, string charSet, MessageVersion version )
{
_version = version;
_mediaType = mediaType;
_charSet = charSet;
_encoder = new CustomTextMessageEncoder( this );
}
示例4: ReverseWebProxy
public ReverseWebProxy(Uri upstreamUri, Uri downstreamUri, TransportClientEndpointBehavior credentials)
{
this.upstreamUri = upstreamUri;
this.downstreamUri = downstreamUri;
this.upstreamBasePath = this.upstreamUri.PathAndQuery;
if (this.upstreamBasePath.EndsWith("/"))
{
this.upstreamBasePath = this.upstreamBasePath.Substring(0, this.upstreamBasePath.Length - 1);
}
ServicePointManager.DefaultConnectionLimit = 50;
WebHttpRelayBinding relayBinding = new WebHttpRelayBinding(EndToEndWebHttpSecurityMode.None, RelayClientAuthenticationType.None);
relayBinding.MaxReceivedMessageSize = int.MaxValue;
relayBinding.TransferMode = TransferMode.Streamed;
relayBinding.AllowCookies = false;
relayBinding.ReceiveTimeout = TimeSpan.MaxValue;
relayBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
relayBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
this.upstreamBinding = relayBinding;
WebMessageEncodingBindingElement encoderBindingElement = new WebMessageEncodingBindingElement();
encoderBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
encoderBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;
encoderBindingElement.ContentTypeMapper = new RawContentTypeMapper();
encoder = encoderBindingElement.CreateMessageEncoderFactory().Encoder;
this.credentials = credentials;
}
示例5: WebScriptMetadataMessageEncoder
public WebScriptMetadataMessageEncoder(XmlDictionaryReaderQuotas quotas)
{
this.readerQuotas = new XmlDictionaryReaderQuotas();
quotas.CopyTo(this.readerQuotas);
this.mediaType = this.contentType = applicationJavaScriptMediaType;
this.innerReadMessageEncoder = new TextMessageEncodingBindingElement(MessageVersion.None, Encoding.UTF8).CreateMessageEncoderFactory().Encoder;
}
示例6: XeroMessageEncoderFactory
public XeroMessageEncoderFactory(MessageEncoderFactory innerEncoderFactory)
{
if (innerEncoderFactory == null)
throw new ArgumentNullException("innerEncoderFactory");
_encoder = new XeroMessageEncoder(innerEncoderFactory.Encoder);
}
示例7: SerialChannelBase
/// <summary>
/// SerialChannel Base
/// </summary>
/// <param name="bufferManager">
/// Buffer manager created by factory and listener</param>
/// <param name="encoderFactory">
/// Referece to encoder factory as returned by encoder element</param>
/// <param name="address">Remote address</param>
/// <param name="portNumber">COM port number</param>
/// <param name="parent">reference to factory/listener</param>
/// <param name="maxReceivedMessageSize">
/// Some settings for transport channel</param>
public SerialChannelBase(BufferManager bufferManager,
MessageEncoderFactory encoderFactory,
EndpointAddress address,
string portNumber,
ChannelManagerBase parent,
long maxReceivedMessageSize)
: base(parent)
{
this.address = address;
this.bufferManager = bufferManager;
this.encoder = encoderFactory.CreateSessionEncoder();
this.maxReceivedMessageSize = maxReceivedMessageSize;
this.portNumber = portNumber;
// Create port
serialPort = new SerialPort();
// Set the appropriate properties.
serialPort.PortName = this.portNumber;
//TODO: Read these settings from configuration file
serialPort.BaudRate = 9600;
serialPort.Parity = Parity.None;
serialPort.DataBits = 8;
serialPort.StopBits = StopBits.One;
serialPort.Handshake = Handshake.None;
// Set the read/write timeouts
serialPort.ReadTimeout = 500;
serialPort.WriteTimeout = 500;
}
示例8: GZipMessageEncoderFactory
//The GZip encoder wraps an inner encoder
//We require a factory to be passed in that will create this inner encoder
public GZipMessageEncoderFactory(MessageEncoderFactory messageEncoderFactory)
{
if (messageEncoderFactory == null)
throw new ArgumentNullException("messageEncoderFactory", "A valid message encoder factory must be passed to the GZipEncoder");
encoder = new GZipMessageEncoder(messageEncoderFactory.Encoder);
}
示例9: DecodeSessiongramMessage
private static Message DecodeSessiongramMessage(MsmqInputSessionChannelListener listener, MsmqInputSessionChannel channel, MessageEncoder encoder, MsmqMessageProperty messageProperty, byte[] buffer, int offset, int size)
{
Message message2;
if (size > listener.MaxReceivedMessageSize)
{
channel.FaultChannel();
listener.MsmqReceiveHelper.FinalDisposition(messageProperty);
throw listener.NormalizePoisonException(messageProperty.LookupId, MaxMessageSizeStream.CreateMaxReceivedMessageSizeExceededException(listener.MaxReceivedMessageSize));
}
if ((size + offset) > buffer.Length)
{
listener.MsmqReceiveHelper.FinalDisposition(messageProperty);
throw listener.NormalizePoisonException(messageProperty.LookupId, new ProtocolException(System.ServiceModel.SR.GetString("MsmqBadFrame")));
}
byte[] dst = listener.BufferManager.TakeBuffer(size);
Buffer.BlockCopy(buffer, offset, dst, 0, size);
try
{
Message message = null;
using (MsmqDiagnostics.BoundDecodeOperation())
{
message = encoder.ReadMessage(new ArraySegment<byte>(dst, 0, size), listener.BufferManager);
MsmqDiagnostics.TransferFromTransport(message);
}
message2 = message;
}
catch (XmlException exception)
{
channel.FaultChannel();
listener.MsmqReceiveHelper.FinalDisposition(messageProperty);
throw listener.NormalizePoisonException(messageProperty.LookupId, new ProtocolException(System.ServiceModel.SR.GetString("MsmqBadXml"), exception));
}
return message2;
}
示例10: XeroMessageEncoder
public XeroMessageEncoder(MessageEncoder innerEncoder)
{
if (innerEncoder == null)
throw new ArgumentNullException("innerEncoder");
_encoder = innerEncoder;
}
示例11: RabbitMQTransportOutputChannel
public RabbitMQTransportOutputChannel(BindingContext context, EndpointAddress address, Uri via)
: base(context, address, via)
{
_bindingElement = context.Binding.Elements.Find<RabbitMQTransportBindingElement>();
MessageEncodingBindingElement encoderElement;
if (_bindingElement.MessageFormat == MessageFormat.MTOM)
{
encoderElement = context.Binding.Elements.Find<MtomMessageEncodingBindingElement>();
}
else if (_bindingElement.MessageFormat == MessageFormat.NetBinary)
{
encoderElement = context.Binding.Elements.Find<BinaryMessageEncodingBindingElement>();
}
else
{
encoderElement = context.Binding.Elements.Find<TextMessageEncodingBindingElement>();
}
if (encoderElement != null)
{
_encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
}
_messageProcessor = context.BindingParameters.Find<IFaultMessageProcessor>();
}
示例12: SmevServiceMessageEncoder
public SmevServiceMessageEncoder(SmevServiceMessageEncoderFactory factory)
{
_factory = factory;
_innerEncoder = factory.InnerMessageFactory.Encoder;
_contentType = _factory.MediaType;
LogPath = _factory.LogPath;
}
示例13: FillMessageEncoder
void FillMessageEncoder (BindingContext ctx)
{
var mbe = (MessageEncodingBindingElement) ctx.Binding.Elements.FirstOrDefault (be => be is MessageEncodingBindingElement);
if (mbe == null)
mbe = new TextMessageEncodingBindingElement ();
message_encoder = mbe.CreateMessageEncoderFactory ().Encoder;
}
示例14: AzureProxyHandler
public AzureProxyHandler(Uri requestUrl, Uri responseUrl)
{
_credentials = new TransportClientEndpointBehavior {
CredentialType = TransportClientCredentialType.SharedSecret
};
_credentials.Credentials.SharedSecret.IssuerName = Manager.Configuration.Azure.IssuerName;
_credentials.Credentials.SharedSecret.IssuerSecret = Manager.Configuration.Azure.IssuerSecret;
Init(requestUrl, responseUrl);
ServicePointManager.DefaultConnectionLimit = 50;
_requestBinding = new BasicHttpRelayBinding(EndToEndBasicHttpSecurityMode.None, RelayClientAuthenticationType.None);
_requestBinding.MaxReceivedMessageSize = int.MaxValue;
_requestBinding.TransferMode = TransferMode.Streamed;
_requestBinding.AllowCookies = false;
_requestBinding.ReceiveTimeout = TimeSpan.MaxValue;
_requestBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
_requestBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
_requestBinding.MaxReceivedMessageSize = int.MaxValue;
_requestBinding.MaxBufferSize = 4 * 1024 * 1024;
_requestBinding.MaxBufferPoolSize = 32 * 4 * 1024 * 1024;
WebMessageEncodingBindingElement encoderBindingElement = new WebMessageEncodingBindingElement();
encoderBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
encoderBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;
encoderBindingElement.ReaderQuotas.MaxDepth = 128;
encoderBindingElement.ReaderQuotas.MaxBytesPerRead = 65536;
encoderBindingElement.ContentTypeMapper = new RawContentTypeMapper();
_webEncoder = encoderBindingElement.CreateMessageEncoderFactory().Encoder;
}
示例15: MockChannelBase
public MockChannelBase(ChannelManagerBase manager, MessageEncoderFactory encoderFactory, EndpointAddress address)
: base(manager)
{
_address = address;
_manager = manager;
_encoder = encoderFactory.CreateSessionEncoder();
OpenAsyncResult = new MockAsyncResult();
CloseAsyncResult = new MockAsyncResult();
GetEndpointPropertyOverride = DefaultGetEndpointProperty;
// CommunicationObject overrides
DefaultCloseTimeoutOverride = DefaultDefaultCloseTimeout;
DefaultOpenTimeoutOverride = DefaultDefaultOpenTimeout;
OnAbortOverride = DefaultOnAbort;
OnOpenOverride = DefaultOnOpen;
OnCloseOverride = DefaultOnClose;
OnBeginOpenOverride = DefaultOnBeginOpen;
OnEndOpenOverride = DefaultOnEndOpen;
OnBeginCloseOverride = DefaultOnBeginClose;
OnEndCloseOverride = DefaultOnEndClose;
// All the virtuals
OnOpeningOverride = DefaultOnOpening;
OnOpenedOverride = DefaultOnOpened;
OnClosingOverride = DefaultOnClosing;
OnClosedOverride = DefaultOnClosed;
OnFaultedOverride = DefaultOnFaulted;
}