WsrmTraceRecord.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Diagnostics / WsrmTraceRecord.cs / 1 / WsrmTraceRecord.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Diagnostics
{ 
    using System;
    using System.Globalization; 
    using System.ServiceModel; 
    using System.ServiceModel.Channels;
    using System.ServiceModel.Diagnostics; 
    using System.Xml;
    using System.Collections.Generic;

 
    internal class WsrmTraceRecord : TraceRecord
    { 
        UniqueId id; 

        internal WsrmTraceRecord(UniqueId id) 
        {
            this.id = id;
        }
 
        internal override string EventId
        { 
            get 
            {
                return TraceRecord.EventIdBase + "Sequence" + TraceRecord.NamespaceSuffix; 
            }
        }

        internal override void WriteTo(XmlWriter writer) 
        {
            base.WriteTo(writer); 
            writer.WriteStartElement("Identifier"); 
            writer.WriteString(id.ToString());
            writer.WriteEndElement(); 
        }
    }

    internal class ReliableChannelTraceRecord : ChannelTraceRecord 
    {
        UniqueId id; 
 
        internal ReliableChannelTraceRecord(IChannel channel, UniqueId id) : base(channel)
        { 
            this.id = id;
        }

        internal override void WriteTo(XmlWriter writer) 
        {
            base.WriteTo(writer); 
            writer.WriteStartElement("Identifier"); 
            writer.WriteString(id.ToString());
            writer.WriteEndElement(); 
        }
    }

    internal class SequenceTraceRecord : WsrmTraceRecord 
    {
        Int64 sequenceNumber; 
        bool isLast; 

        internal SequenceTraceRecord(UniqueId id, Int64 sequenceNumber, bool isLast) : base(id) 
        {
            this.sequenceNumber = sequenceNumber;
            this.isLast = isLast;
        } 

        internal override void WriteTo(XmlWriter writer) 
        { 
            base.WriteTo(writer);
            writer.WriteStartElement("MessageNumber"); 
            writer.WriteString(this.sequenceNumber.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();
            writer.WriteStartElement("LastMessage");
            writer.WriteString(this.isLast.ToString(CultureInfo.InvariantCulture)); 
            writer.WriteEndElement();
        } 
    } 

    internal class SequenceFaultedTraceRecord : WsrmTraceRecord 
    {
        string reason;

        internal SequenceFaultedTraceRecord(UniqueId id, string reason) : base(id) 
        {
            this.reason = reason; 
        } 

        internal override void WriteTo(XmlWriter writer) 
        {
            base.WriteTo(writer);
            writer.WriteStartElement("Reason");
            writer.WriteString(reason); 
            writer.WriteEndElement();
        } 
    } 

    internal class AcknowledgementTraceRecord : WsrmTraceRecord 
    {
        int bufferRemaining;
        IList ranges;
 
        internal AcknowledgementTraceRecord(UniqueId id, IList ranges, int bufferRemaining)
            : base(id) 
        { 
            this.bufferRemaining = bufferRemaining;
            this.ranges = ranges; 
        }

        internal override void WriteTo(XmlWriter writer)
        { 
            base.WriteTo(writer);
            writer.WriteStartElement("Ranges"); 
            for (int i = 0; i < this.ranges.Count; i++) 
            {
                writer.WriteStartElement("Range"); 
                writer.WriteAttributeString("Lower", this.ranges[i].Lower.ToString(CultureInfo.InvariantCulture));
                writer.WriteAttributeString("Upper", this.ranges[i].Upper.ToString(CultureInfo.InvariantCulture));
                writer.WriteEndElement();
            } 
            writer.WriteEndElement();
            if (this.bufferRemaining != -1) 
            { 
                writer.WriteStartElement("BufferRemaining");
                writer.WriteString(bufferRemaining.ToString(CultureInfo.InvariantCulture)); 
                writer.WriteEndElement();
            }
        }
    } 
}
 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK