Exemple #1
0
        /// <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));
                }
            }
        }
Exemple #2
0
 private static string Format(DnsClient.IDnsResponse response)
 {
     return($"Invalid response received with code {response.ResponseCode}");
 }
Exemple #3
0
 internal DnsQueryException(DnsClient.IDnsResponse response, Exception e)
     : base(Format(response), e)
 {
     Response = response;
 }
Exemple #4
0
 internal DnsQueryException(DnsClient.IDnsResponse response, string message)
     : base(message)
 {
     Response = response;
 }
Exemple #5
0
 internal DnsQueryException(DnsClient.IDnsResponse response)
     : this(response, Format(response))
 {
 }