private static bool InternalTryParseFromAD(string s, bool extendedFormat, out SmtpDomainWithSubdomains domain, out SmtpReceiveCapabilities capabilities, out SmtpX509Identifier x509Identifier)
        {
            domain         = null;
            x509Identifier = null;
            capabilities   = SmtpReceiveCapabilities.None;
            if (string.IsNullOrWhiteSpace(s))
            {
                return(false);
            }
            int num = s.IndexOf(':');

            if (num <= 0 || num == s.Length - 1)
            {
                return(false);
            }
            string text = s.Substring(0, num);

            if (!SmtpDomainWithSubdomains.TryParse(text.Trim(), out domain))
            {
                return(false);
            }
            int    num2;
            string stringPart = SmtpReceiveDomainCapabilities.GetStringPart(s, extendedFormat, false, num + 1, out num2);

            if (!SmtpReceiveDomainCapabilities.TryGetCapabilities(stringPart, out capabilities))
            {
                domain = null;
                return(false);
            }
            if (num2 > num && num2 < s.Length)
            {
                int                num3;
                string             stringPart2        = SmtpReceiveDomainCapabilities.GetStringPart(s, extendedFormat, true, num2 + 1, out num3);
                SmtpX509Identifier smtpX509Identifier = null;
                if (SmtpX509Identifier.TryParse(stringPart2, out smtpX509Identifier))
                {
                    domain         = smtpX509Identifier.SubjectCommonName;
                    x509Identifier = smtpX509Identifier;
                }
                else
                {
                    x509Identifier = null;
                }
            }
            return(true);
        }
        private static bool InternalTryParse(string s, bool extendedFormat, out SmtpDomainWithSubdomains domain, out SmtpReceiveCapabilities capabilities, out SmtpX509Identifier x509Identifier)
        {
            domain         = null;
            x509Identifier = null;
            capabilities   = SmtpReceiveCapabilities.None;
            if (string.IsNullOrWhiteSpace(s))
            {
                return(false);
            }
            int    num;
            string stringPart = SmtpReceiveDomainCapabilities.GetStringPart(s, true, true, 0, out num);

            if (num == s.Length - 1 || num == s.Length)
            {
                return(false);
            }
            SmtpX509Identifier smtpX509Identifier = null;

            if (SmtpX509Identifier.TryParse(stringPart, out smtpX509Identifier))
            {
                domain         = smtpX509Identifier.SubjectCommonName;
                x509Identifier = smtpX509Identifier;
            }
            if (domain == null && !SmtpDomainWithSubdomains.TryParse(stringPart.Trim(), out domain))
            {
                return(false);
            }
            int    num2;
            string stringPart2 = SmtpReceiveDomainCapabilities.GetStringPart(s, extendedFormat, false, num + 1, out num2);

            if (!SmtpReceiveDomainCapabilities.TryGetCapabilities(stringPart2, out capabilities))
            {
                domain         = null;
                x509Identifier = null;
                return(false);
            }
            return(true);
        }