public static Parse ( string mailbox ) : |
||
mailbox | string | Mailbox string. Format: ["diplay-name"<SP>]<local-part@domain>. |
리턴 |
/// <summary> /// Parses address-list from string. /// </summary> /// <param name="addressList">Address list string.</param> /// <returns></returns> public void Parse(string addressList) { addressList = addressList.Trim(); StringReader reader = new StringReader(addressList); while (reader.SourceString.Length > 0) { // See if mailbox or group. If ',' is before ':', then mailbox // Example: [email protected], group:[email protected]; int commaIndex = TextUtils.QuotedIndexOf(reader.SourceString, ','); int colonIndex = TextUtils.QuotedIndexOf(reader.SourceString, ':'); // Mailbox if (colonIndex == -1 || (commaIndex < colonIndex && commaIndex != -1)) { // FIX: why quotes missing //System.Windows.Forms.MessageBox.Show(reader.SourceString + "#" + reader.OriginalString); // Read to ',' or to end if last element MailboxAddress address = MailboxAddress.Parse(reader.QuotedReadToDelimiter(',')); m_pAddresses.Add(address); address.Owner = this; } // Group else { // Read to ';', this is end of group GroupAddress address = GroupAddress.Parse(reader.QuotedReadToDelimiter(';')); m_pAddresses.Add(address); address.Owner = this; // If there are next items, remove first comma because it's part of group address if (reader.SourceString.Length > 0) { reader.QuotedReadToDelimiter(','); } } } OnCollectionChanged(); }