Click here to Skip to main content
15,903,203 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamincially Adding Controls to a Win Form Pin
David Stone29-Mar-03 6:23
sitebuilderDavid Stone29-Mar-03 6:23 
GeneralRe: Dynamincially Adding Controls to a Win Form Pin
siqbal29-Mar-03 13:41
siqbal29-Mar-03 13:41 
GeneralRe: Dynamincially Adding Controls to a Win Form Pin
David Stone29-Mar-03 16:59
sitebuilderDavid Stone29-Mar-03 16:59 
GeneralRe: Dynamincially Adding Controls to a Win Form Pin
Stephane Rodriguez.30-Mar-03 5:42
Stephane Rodriguez.30-Mar-03 5:42 
GeneralInt textBox Pin
blink4me28-Mar-03 9:32
blink4me28-Mar-03 9:32 
GeneralRe: Int textBox Pin
Andreas Philipson29-Mar-03 2:51
Andreas Philipson29-Mar-03 2:51 
GeneralRe: Int textBox Pin
blink4me29-Mar-03 4:59
blink4me29-Mar-03 4:59 
GeneralMime parsing algorithm suggestions requested Pin
Member 9628-Mar-03 8:52
Member 9628-Mar-03 8:52 
Hello, I've inserted below a portion of source code from a non-copyrighted freeware mime parsing algorithm implemented in C# I came across on the internet.

I'm fairly new to c# and I'm finding this algorithm painfully slow and was wondering if anyone had any suggestions for improving this.

It's actually not bad for any email that contains mime entries that are under 300k, but I tested against an email with a multi-megabyte attachment and it took approximately 10 minutes to process it. The slow bit is definitely the part that searches for the boundaries "---" line by line.

Any suggestions would be very welcome. Once I have it working properly and consistently I will post it as an article.

internal ArrayList ParseEntries(MemoryStream msgStrm,int pos,string boundaryID)<br />
		{<br />
			ArrayList entries = new ArrayList();<br />
<br />
			msgStrm.Position = pos;<br />
<br />
			if(boundaryID.Length > 0){<br />
				using(TextReader r = new StreamReader(msgStrm)){<br />
					string line = r.ReadLine();<br />
<br />
					bool   firstFound = false;<br />
					string buffer = "";<br />
					while(line != null){				<br />
						// Next boundary<br />
						if(line.StartsWith("--" + boundaryID)){<br />
							// Add Entry<br />
							if(buffer.Length > 0){<br />
								entries.Add(new MimeEntry(buffer,this));						<br />
							}<br />
														<br />
							firstFound = true;<br />
							buffer = "";<br />
						}<br />
						else{<br />
							if(firstFound){<br />
								buffer += line + "\r\n";<br />
							}<br />
						}<br />
						<br />
						line = r.ReadLine();<br />
					}<br />
				}<br />
			}<br />
<br />
			return entries;<br />
		}

GeneralRe: Mime parsing algorithm suggestions requested Pin
leppie28-Mar-03 11:53
leppie28-Mar-03 11:53 
GeneralRe: Mime parsing algorithm suggestions requested Pin
Member 9628-Mar-03 12:12
Member 9628-Mar-03 12:12 
GeneralC# class Question Pin
econner28-Mar-03 6:32
econner28-Mar-03 6:32 
GeneralRe: C# class Question Pin
leppie28-Mar-03 6:52
leppie28-Mar-03 6:52 
GeneralRe: C# class Question Pin
econner28-Mar-03 6:57
econner28-Mar-03 6:57 
GeneralRe: C# class Question Pin
leppie28-Mar-03 7:10
leppie28-Mar-03 7:10 
GeneralRe: C# class Question Pin
econner29-Mar-03 13:08
econner29-Mar-03 13:08 
Generalout Arguments calling a COM+ Component Pin
ricvilla28-Mar-03 4:27
ricvilla28-Mar-03 4:27 
GeneralRe: out Arguments calling a COM+ Component Pin
pallep428-Mar-03 7:01
pallep428-Mar-03 7:01 
GeneralRe: out Arguments calling a COM+ Component Pin
ricvilla28-Mar-03 7:09
ricvilla28-Mar-03 7:09 
GeneralMemory usage Pin
Oleksandr Kucherenko28-Mar-03 4:15
Oleksandr Kucherenko28-Mar-03 4:15 
GeneralRe: Memory usage Pin
pallep428-Mar-03 7:07
pallep428-Mar-03 7:07 
GeneralHelp me please ! Design form Pin
tuan_tomy28-Mar-03 0:54
tuan_tomy28-Mar-03 0:54 
GeneralRe: Help me please ! Design form Pin
Stephane Rodriguez.28-Mar-03 2:24
Stephane Rodriguez.28-Mar-03 2:24 
GeneralDockingManager Focus Problems Pin
pallep427-Mar-03 22:07
pallep427-Mar-03 22:07 
GeneralDetect if any control in a form has changed Pin
Braulio Dez27-Mar-03 21:06
Braulio Dez27-Mar-03 21:06 
GeneralRe: Detect if any control in a form has changed Pin
krisp28-Mar-03 7:30
krisp28-Mar-03 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.