WriteLongTermId() public static method

Write a LongTermId value to a stream and advances the position within the stream by 24.
public static WriteLongTermId ( Stream stream, LongTermId id ) : int
stream Stream The stream.
id Microsoft.Protocols.TestSuites.Common.LongTermId A LongTermId value.
return int
コード例 #1
0
        /// <summary>
        /// Serialize this instance to a stream.
        /// </summary>
        /// <param name="stream">A data stream contains serialized object.</param>
        /// <returns>The number of bytes written to the stream.</returns>
        public int Serialize(System.IO.Stream stream)
        {
            int    bytesWriten = 0;
            string serverDns   = string.Empty;

            for (int i = 0; i < this.ServerDNArray.Length; i++)
            {
                serverDns += this.ServerDNArray[i];
            }

            byte[] serverDnBytes = System.Text.Encoding.ASCII.GetBytes(serverDns);

            bytesWriten += StreamHelper.WriteUInt32(stream, this.Flags);
            bytesWriten += StreamHelper.WriteUInt32(stream, this.Depth);
            bytesWriten += StreamHelper.WriteLongTermId(stream, this.FolderLongTermId);
            bytesWriten += StreamHelper.WriteUInt32(stream, this.ServerDNCount);
            bytesWriten += StreamHelper.WriteUInt32(stream, this.CheapServerDNCount);
            bytesWriten += StreamHelper.WriteBuffer(stream, serverDnBytes);
            return(bytesWriten);
        }