当前位置: 首页>>代码示例>>C#>>正文


C# Message.WriteMessage方法代码示例

本文整理汇总了C#中System.Globalization.Message.WriteMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Message.WriteMessage方法的具体用法?C# Message.WriteMessage怎么用?C# Message.WriteMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Globalization.Message的用法示例。


在下文中一共展示了Message.WriteMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSerializedMessage

		public static string GetSerializedMessage (Message msg)
		{
			StringWriter sw = new StringWriter ();
			XmlWriterSettings settings = new XmlWriterSettings ();
			settings.OmitXmlDeclaration = true;
			using (XmlWriter xw = XmlWriter.Create (sw, settings)) {
				msg.WriteMessage (xw);
			}
			return sw.ToString ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:MessageTest.cs

示例2: WriteMessage

            public override void WriteMessage(Message message, Stream stream)
            {
                if (message == null)
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("message"));
                if (stream == null)
                    throw TraceUtility.ThrowHelperError(new ArgumentNullException("stream"), message);
                ThrowIfMismatchedMessageVersion(message);

                EventTraceActivity eventTraceActivity = null;
                if (TD.TextMessageEncodingStartIsEnabled())
                {
                    eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(message);
                    TD.TextMessageEncodingStart(eventTraceActivity);
                }

                message.Properties.Encoder = this;
                XmlDictionaryWriter xmlWriter = TakeStreamedWriter(stream);
                if (optimizeWriteForUTF8)
                {
                    message.WriteMessage(xmlWriter);
                }
                else
                {
                    xmlWriter.WriteStartDocument();
                    message.WriteMessage(xmlWriter);
                    xmlWriter.WriteEndDocument();
                }
                xmlWriter.Flush();
                ReturnStreamedWriter(xmlWriter);

                if (TD.StreamedMessageWrittenByEncoderIsEnabled())
                {
                    TD.StreamedMessageWrittenByEncoder(eventTraceActivity ?? EventTraceActivityHelper.TryExtractActivity(message));
                }

                if (MessageLogger.LogMessagesAtTransportLevel)
                    MessageLogger.LogMessage(ref message, MessageLoggingSource.TransportSend);
            }
开发者ID:JianwenSun,项目名称:cc,代码行数:38,代码来源:TextMessageEncoder.cs

示例3: WriteMessage

        void WriteMessage(Message message, Stream stream, string startInfo, string boundary, string startUri, bool writeMessageHeaders)
        {
            if (message == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("message"));
            if (stream == null)
                throw TraceUtility.ThrowHelperError(new ArgumentNullException("stream"), message);
            ThrowIfMismatchedMessageVersion(message);

            EventTraceActivity eventTraceActivity = null;
            if (TD.MtomMessageEncodingStartIsEnabled())
            {
                eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(message);
                TD.MtomMessageEncodingStart(eventTraceActivity);
            }

            message.Properties.Encoder = this;
            if (MessageLogger.LogMessagesAtTransportLevel)
                MessageLogger.LogMessage(ref message, MessageLoggingSource.TransportSend);
            XmlDictionaryWriter xmlWriter = TakeStreamedWriter(stream, startInfo, boundary, startUri, writeMessageHeaders);
            if (this.writeEncoding.WebName == "utf-8")
            {
                message.WriteMessage(xmlWriter);
            }
            else
            {
                xmlWriter.WriteStartDocument();
                message.WriteMessage(xmlWriter);
                xmlWriter.WriteEndDocument();
            }
            xmlWriter.Flush();
            ReturnStreamedWriter(xmlWriter);

            if (TD.StreamedMessageWrittenByEncoderIsEnabled())
            {
                TD.StreamedMessageWrittenByEncoder(eventTraceActivity ?? EventTraceActivityHelper.TryExtractActivity(message));
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:37,代码来源:MtomMessageEncoder.cs

示例4: WriteMessage

            public override void WriteMessage(Message message, Stream stream)
            {
                if (message == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("message"));
                }
                if (stream == null)
                {
                    throw TraceUtility.ThrowHelperError(new ArgumentNullException("stream"), message);
                }
                ThrowIfMismatchedMessageVersion(message);

                EventTraceActivity eventTraceActivity = null;
                if (WebTD.JsonMessageEncodingStartIsEnabled())
                {
                    eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(message);
                    WebTD.JsonMessageEncodingStart(eventTraceActivity);
                }

                message.Properties.Encoder = this;
                XmlDictionaryWriter xmlWriter = TakeStreamedWriter(stream);
                JavascriptCallbackResponseMessageProperty javascriptResponseMessageProperty;
                if (message.Properties.TryGetValue<JavascriptCallbackResponseMessageProperty>(JavascriptCallbackResponseMessageProperty.Name, out javascriptResponseMessageProperty)
                    && javascriptResponseMessageProperty != null
                    && !String.IsNullOrEmpty(javascriptResponseMessageProperty.CallbackFunctionName))
                {
                    if (!this.crossDomainScriptAccessEnabled)
                    {
                        throw TraceUtility.ThrowHelperError(new InvalidOperationException(SR2.JavascriptCallbackNotEnabled), message);
                    }
                    byte[] buffer = this.writeEncoding.GetBytes(String.Format(CultureInfo.InvariantCulture, "{0}(", javascriptResponseMessageProperty.CallbackFunctionName));
                    stream.Write(buffer, 0, buffer.Length);
                }
                xmlWriter.WriteStartDocument();
                message.WriteMessage(xmlWriter);
                xmlWriter.WriteEndDocument();
                xmlWriter.Flush();
                ReturnStreamedWriter(xmlWriter);
                if (javascriptResponseMessageProperty != null
                    && !String.IsNullOrEmpty(javascriptResponseMessageProperty.CallbackFunctionName))
                {
                    if (javascriptResponseMessageProperty.StatusCode != null && (int)javascriptResponseMessageProperty.StatusCode != 200)
                    {
                        byte[] buffer = this.writeEncoding.GetBytes(String.Format(CultureInfo.InvariantCulture, ",{0}", (int)javascriptResponseMessageProperty.StatusCode));
                        stream.Write(buffer, 0, buffer.Length);
                    }
                    stream.Write(this.encodedClosingFunctionCall, 0, this.encodedClosingFunctionCall.Length);
                }

                if (SMTD.StreamedMessageWrittenByEncoderIsEnabled())
                {
                    SMTD.StreamedMessageWrittenByEncoder(
                        eventTraceActivity ?? EventTraceActivityHelper.TryExtractActivity(message));
                }

                if (MessageLogger.LogMessagesAtTransportLevel)
                {
                    MessageLogger.LogMessage(ref message, MessageLoggingSource.TransportSend);
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:JsonMessageEncoderFactory.cs

示例5: WriteMessage

 private void WriteMessage(Message message, Stream stream, string startInfo, string boundary, string startUri, bool writeMessageHeaders)
 {
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("message"));
     }
     if (stream == null)
     {
         throw TraceUtility.ThrowHelperError(new ArgumentNullException("stream"), message);
     }
     base.ThrowIfMismatchedMessageVersion(message);
     message.Properties.Encoder = this;
     if (MessageLogger.LogMessagesAtTransportLevel)
     {
         MessageLogger.LogMessage(ref message, MessageLoggingSource.TransportSend);
     }
     XmlDictionaryWriter writer = this.TakeStreamedWriter(stream, startInfo, boundary, startUri, writeMessageHeaders);
     if (this.writeEncoding.WebName == "utf-8")
     {
         message.WriteMessage(writer);
     }
     else
     {
         writer.WriteStartDocument();
         message.WriteMessage(writer);
         writer.WriteEndDocument();
     }
     writer.Flush();
     this.ReturnStreamedWriter(writer);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:MtomMessageEncoder.cs


注:本文中的System.Globalization.Message.WriteMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。