コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Reads mail exchange. </summary>
        ///
        /// <param name="reader">   The reader. </param>
        ///
        /// <returns>   The mail exchange. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        private static MailExchange ReadMailExchange(BinaryReader reader)
        {
            MailExchange mailExchange = new MailExchange();

            mailExchange.Preference = ReadUInt16BE(reader);
            mailExchange.HostName   = ReadDomainName(reader);
            return(mailExchange);
        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Gets mail exchange aliases. </summary>
        ///
        /// <param name="domainName">   domainName. </param>
        /// <param name="answer">       The answer. </param>
        ///
        /// <returns>   An array of string. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private static string[] GetMailExchangeAliases(string domainName, DnsMessage answer)
        {
            List <string> aliases = new List <string>();

            foreach (DnsResource resource in answer.Answers)
            {
                if (resource.QueryType == QueryType.MailExchange && resource.Name == domainName)
                {
                    MailExchange mailExchange = (MailExchange)resource.Content;
                    aliases.Add(mailExchange.HostName);
                }
            }
            return(aliases.ToArray());
        }