Ejemplo n.º 1
0
        public void WriteUInt32()
        {
            var text   = new StringWriter();
            var writer = new PresentationWriter(text);

            writer.WriteUInt32(int.MaxValue);
            writer.WriteUInt32(1, appendSpace: false);
            Assert.AreEqual("2147483647 1", text.ToString());
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public override void WriteData(PresentationWriter writer)
 {
     writer.WriteDomainName(PrimaryName);
     writer.WriteDomainName(Mailbox);
     writer.WriteUInt32(SerialNumber);
     writer.WriteTimeSpan32(Refresh);
     writer.WriteTimeSpan32(Retry);
     writer.WriteTimeSpan32(Expire);
     writer.WriteTimeSpan32(Minimum, appendSpace: false);
 }
Ejemplo n.º 3
0
        /// <summary>
        ///   Write the textual representation of the data that is specific to
        ///   the resource record.
        /// </summary>
        /// <param name="writer">
        ///   The destination for the resource record's data.
        /// </param>
        /// <remarks>
        ///   Derived classes should implement this method.
        ///   <para>
        ///   By default, this will write the hex encoding of
        ///   the <see cref="GetData">RDATA</see> preceeded by
        ///   "\#" and the number integer bytes.
        ///   </para>
        /// </remarks>
        public virtual void WriteData(PresentationWriter writer)
        {
            var rdata   = GetData();
            var hasData = rdata.Length > 0;

            writer.WriteStringUnencoded("\\#");
            writer.WriteUInt32((uint)rdata.Length, appendSpace: hasData);
            if (hasData)
            {
                writer.WriteBase16String(rdata, appendSpace: false);
            }
        }