Example #1
0
 /// <summary>
 /// Send recipients addresses to the server
 /// </summary>
 /// <param name="recipients">Recipient address list</param>
 private void DeliverTo(MailAddressList recipients)
 {
     foreach (MailAddress addr in recipients)
     {
         DeliverTo(addr);
     }
 }
Example #2
0
 /// <summary>
 ///		Creates a read-only wrapper for a
 ///     <c>MailAddressList</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>MailAddressList</c> wrapper that is read-only.
 /// </returns>
 public static MailAddressList ReadOnly(MailAddressList list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new ReadOnlyMailAddressList(list));
 }
Example #3
0
 /// <summary>
 ///		Creates a synchronized (thread-safe) wrapper for a
 ///     <c>MailAddressList</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>MailAddressList</c> wrapper that is synchronized (thread-safe).
 /// </returns>
 public static MailAddressList Synchronized(MailAddressList list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new SyncMailAddressList(list));
 }
Example #4
0
        /// <summary>
        ///		Creates a shallow copy of the <see cref="MailAddressList"/>.
        /// </summary>
        public virtual object Clone()
        {
            MailAddressList newColl = new MailAddressList(m_count);

            Array.Copy(m_array, 0, newColl.m_array, 0, m_count);
            newColl.m_count   = m_count;
            newColl.m_version = m_version;

            return(newColl);
        }
Example #5
0
        /// <summary>
        ///		Adds the elements of another <c>MailAddressList</c> to the current <c>MailAddressList</c>.
        /// </summary>
        /// <param name="x">The <c>MailAddressList</c> whose elements should be added to the end of the current <c>MailAddressList</c>.</param>
        /// <returns>The new <see cref="MailAddressList.Count"/> of the <c>MailAddressList</c>.</returns>
        public virtual int AddRange(MailAddressList x)
        {
            if (m_count + x.Count >= m_array.Length)
            {
                EnsureCapacity(m_count + x.Count);
            }

            Array.Copy(x.m_array, 0, m_array, m_count, x.Count);
            m_count += x.Count;
            m_version++;

            return(m_count);
        }
Example #6
0
            public override int AddRange(MailAddressList x)
            {
                int result = 0;

                rwLock.AcquireWriterLock(timeout);

                try
                {
                    result = collection.AddRange(x);
                }
                finally
                {
                    rwLock.ReleaseWriterLock();
                }

                return(result);
            }
Example #7
0
 /// <summary>
 /// Read adresses from header line and add each address in "List"
 /// </summary>
 /// <param name="List">The address list to initialize</param>
 /// <param name="Src">A string containing header line with address list</param>
 public void ReadAddresses(ref MailAddressList List, string Src)
 {
     string[] s = Src.Split(';');
     if (s == null)
     {
         List.Add(new MailAddress(Src));
     }
     else
     {
         foreach (string a in s)
         {
             int    p;
             string tmp = a;
             while ((p = tmp.LastIndexOf("\r\n")) != -1)
             {
                 tmp = tmp.Remove(p, 2);
             }
             List.Add(new MailAddress(tmp));
         }
     }
 }
Example #8
0
 internal SyncMailAddressList(MailAddressList list) : base(Tag.Default)
 {
     rwLock     = new System.Threading.ReaderWriterLock();
     collection = list;
 }
Example #9
0
 /// <summary>
 ///		Initializes a new instance of the <c>Enumerator</c> class.
 /// </summary>
 /// <param name="tc"></param>
 internal Enumerator(MailAddressList tc)
 {
     m_collection = tc;
     m_index      = -1;
     m_version    = tc.m_version;
 }
Example #10
0
 /// <summary>
 ///		Initializes a new instance of the <c>MailAddressList</c> class
 ///		that contains elements copied from the specified <c>MailAddressList</c>.
 /// </summary>
 /// <param name="c">The <c>MailAddressList</c> whose elements are copied to the new collection.</param>
 public MailAddressList(MailAddressList c)
 {
     m_array = new MailAddress[c.Count];
     AddRange(c);
 }
Example #11
0
 public override int AddRange(MailAddressList x)
 {
     throw new NotSupportedException("This is a Read Only Collection and can not be modified");
 }
Example #12
0
 internal ReadOnlyMailAddressList(MailAddressList list) : base(Tag.Default)
 {
     m_collection = list;
 }