Exemplo n.º 1
0
 internal void ParseValue(string addresses)
 {
     for (int i = 0; i < addresses.Length; i++)
     {
         MailAddress item = MailBnfHelper.ReadMailAddress(addresses, ref i);
         if (item == null)
         {
             return;
         }
         base.Add(item);
         if (!MailBnfHelper.SkipCFWS(addresses, ref i))
         {
             break;
         }
         if (addresses[i] != ',')
         {
             return;
         }
     }
 }
Exemplo n.º 2
0
        private void ParseValue(string address)
        {
            string str   = null;
            int    index = address.IndexOf('"');

            if (index > 0)
            {
                throw new FormatException(SR.GetString("MailAddressInvalidFormat"));
            }
            if (index == 0)
            {
                index = address.IndexOf('"', 1);
                if (index < 0)
                {
                    throw new FormatException(SR.GetString("MailAddressInvalidFormat"));
                }
                str = address.Substring(1, index - 1);
                if (address.Length == (index + 1))
                {
                    throw new FormatException(SR.GetString("MailAddressInvalidFormat"));
                }
                address = address.Substring(index + 1);
            }
            if (str == null)
            {
                index = address.IndexOf('<');
                if (index > 0)
                {
                    str     = address.Substring(0, index);
                    address = address.Substring(index);
                }
            }
            if (this.displayName == null)
            {
                this.displayName = str;
            }
            index   = 0;
            address = MailBnfHelper.ReadMailAddress(address, ref index, out this.encodedDisplayName);
            this.GetParts(address);
        }