コード例 #1
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            const int BITS_IN_BYTE = 8;

            byte[] buf;

            writer.WriteIPAddress(this.Address);
            writer.WriteByte(this.Protocol);
            if (this.Bitmap.Count % BITS_IN_BYTE != 0)
            {
                this.Bitmap.Length = this.Bitmap.Count + (this.Bitmap.Count % BITS_IN_BYTE);
            }
            buf = new byte[this.Bitmap.Length / BITS_IN_BYTE];
            this.Bitmap.CopyTo(buf, 0);
            writer.WriteBytes(buf);
        }
コード例 #2
0
        /// <summary>
        /// Writes the RDATA of this resource record to the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteData(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteBytes(this.Data);
        }