示例#1
0
        public void WriteStringUnencoded()
        {
            var text   = new StringWriter();
            var writer = new PresentationWriter(text);

            writer.WriteStringUnencoded("\\a");
            writer.WriteStringUnencoded("\\b", appendSpace: false);
            Assert.AreEqual("\\a \\b", text.ToString());
        }
示例#2
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);
            }
        }