/// <summary> /// Initializes a new instance of the <see cref="DnsQueryResult"/> class. /// </summary> /// <param name="response">The response.</param> internal DnsQueryResult(DnsClient.IDnsResponse response) : this() { Id = response.Id; IsAuthoritativeServer = response.IsAuthorativeServer; IsRecursionAvailable = response.IsRecursionAvailable; IsTruncated = response.IsTruncated; OperationCode = response.OperationCode; ResponseCode = response.ResponseCode; if (response.AnswerRecords != null) { foreach (var record in response.AnswerRecords) { AnswerRecords.Add(new DnsRecord(record)); } } if (response.AuthorityRecords != null) { foreach (var record in response.AuthorityRecords) { AuthorityRecords.Add(new DnsRecord(record)); } } if (response.AdditionalRecords != null) { foreach (var record in response.AdditionalRecords) { AdditionalRecords.Add(new DnsRecord(record)); } } }
private static string Format(DnsClient.IDnsResponse response) { return($"Invalid response received with code {response.ResponseCode}"); }
internal DnsQueryException(DnsClient.IDnsResponse response, Exception e) : base(Format(response), e) { Response = response; }
internal DnsQueryException(DnsClient.IDnsResponse response, string message) : base(message) { Response = response; }
internal DnsQueryException(DnsClient.IDnsResponse response) : this(response, Format(response)) { }