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)){
// Read to ',' or to end if last element
m_pAddresses.Add(MailboxAddress.Parse(reader.QuotedReadToDelimiter(',')));
}
// Group
else{
// Read to ';', this is end of group
m_pAddresses.Add(GroupAddress.Parse(reader.QuotedReadToDelimiter(';')));
// If there are next items, remove first comma because it's part of group address
if(reader.SourceString.Length > 0){
reader.QuotedReadToDelimiter(',');
}
}
}
OnCollectionChanged();
}