www.pudn.com > despop3client_demo.zip > Pop3MessageComponents.cs


using System; 
using System.Text; 
using System.Text.RegularExpressions; 
using System.Collections; 
 
namespace Pop3 
{ 
	///  
	/// Summary description for Pop3MessageBody. 
	///  
	public class Pop3MessageComponents 
	{ 
		private ArrayList m_component = new ArrayList(); 
 
		public IEnumerator ComponentEnumerator 
		{ 
			get { return m_component.GetEnumerator(); } 
		} 
 
		public int NumberOfComponents 
		{ 
			get { return m_component.Count; } 
		} 
 
		public Pop3MessageComponents(string[] lines, long startOfBody 
			,string multipartBoundary, string mainContentType) 
		{ 
			long stopOfBody = lines.Length; 
 
			// if this email is a mixture of message 
			// and attachments ... 
 
			if(multipartBoundary == null) 
			{ 
				StringBuilder sbText = new StringBuilder(); 
 
				for(long i=startOfBody; i0) 
					{ 
						data = sbText.ToString(); 
					} 
 
					// create a new component ... 
					m_component.Add(  
						new Pop3Component( 
						contentType, 
						name, 
						filename, 
						contentTransferEncoding, 
						contentDescription, 
						contentDisposition, 
						data)); 
 
					// if all multiparts have been 
					// composed then exit .. 
 
					if(emailComposed) 
					{ 
						break; 
					} 
				} 
			} 
		} 
	} 
}