Пример #1
0
        /// <summary>
        /// Create a new e-mail address.
        /// </summary>
        /// <param name="SimpleEMailAddressString">A string representation of a simple e-mail address.</param>
        /// <param name="SecretKeyRing">The secret key ring for an e-mail address.</param>
        /// <param name="PublicKeyRing">The public key ring for an e-mail address.</param>
        public EMailAddress(String SimpleEMailAddressString,
                            PgpSecretKeyRing SecretKeyRing = null,
                            PgpPublicKeyRing PublicKeyRing = null)

            : this("", SimpleEMailAddress.Parse(SimpleEMailAddressString), SecretKeyRing, PublicKeyRing)

        {
        }
Пример #2
0
        public static EMailAddress Parse(String EMailString)
        {
            if (EMailString.IsNullOrEmpty())
            {
                return(null);
            }

            var b = EMailString.IndexOf('<');
            var c = EMailString.IndexOf('>');

            if (b >= 0 && c > b)
            {
                return(new EMailAddress(EMailString.Remove(b, c - b + 1).Trim(), SimpleEMailAddress.Parse(EMailString.Substring(b + 1, c - b - 1).Trim())));
            }

            return(new EMailAddress(SimpleEMailAddress.Parse(EMailString)));
        }