private void WriteSection(string name, DnsQuestionCollection questions) { if (questions.Count == 0 && GetOption(NDigOptions.SuppressEmptySections)) { return; } WriteLine("{0} SECTION:", name); WriteLine(); if (questions.Count > 0) { foreach (DnsQuestion question in questions) { WriteLine(question.ToString()); } WriteLine(); } }
/// <summary> /// Returns a value indicating if <paramref name="received"/> and /// <paramref name="sent"/> queries are considered equal. This method /// determines equality based only on the query Id and questions. /// </summary> /// <param name="received">The query that was received during the /// operation.</param> /// <param name="sent">The query that was sent during the operation.</param> /// <returns><see langword="true"/> if the queries match, otherwise; /// <see langword="false"/>.</returns> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="sent"/> or <paramref name="received"/> is /// <see langword="null"/>. /// </exception> protected virtual bool QueriesAreEqual(DnsMessage received, DnsMessage sent) { Guard.NotNull(received, "received"); Guard.NotNull(sent, "send"); if (sent.Header.Id != received.Header.Id) { this.Log.Warn("received reply with mismatching id"); return(false); } if (!DnsQuestionCollection.Equals(sent.Questions, received.Questions)) { this.Log.Warn("received reply with mismatching question section"); return(false); } return(true); }