Click here to Skip to main content
16,012,316 members
Home / Discussions / C#
   

C#

 
General.sh >> .BAT Pin
saud_a_k20-Jun-04 18:42
saud_a_k20-Jun-04 18:42 
GeneralRe: .sh >> .BAT Pin
Colin Angus Mackay20-Jun-04 20:18
Colin Angus Mackay20-Jun-04 20:18 
GeneralRe: .sh >> .BAT Pin
saud_a_k20-Jun-04 20:34
saud_a_k20-Jun-04 20:34 
GeneralRe: .sh >> .BAT Pin
eggie521-Jun-04 18:27
eggie521-Jun-04 18:27 
GeneralRe: .sh >> .BAT Pin
saud_a_k21-Jun-04 20:03
saud_a_k21-Jun-04 20:03 
GeneralRe: .sh >> .BAT Pin
eggie522-Jun-04 6:18
eggie522-Jun-04 6:18 
GeneralRe: .sh >> .BAT Pin
saud_a_k22-Jun-04 18:32
saud_a_k22-Jun-04 18:32 
GeneralCode Rewrite Pin
Jacob Koppang20-Jun-04 18:14
Jacob Koppang20-Jun-04 18:14 
I need the two following functions rewritten to be recursive. It's from June's issue of MSDN Magazine, the article about a breadcumb/sitemap control for ASP.Net 1.1. I've translated into C#, but I'm not good with recursion (never have been), so any help would be greatly apprecited! Oh, and one other thing, the web.sitemap file that it reads from is 3 levels deep, these methods take advantage of that (<root><node><node2>), but as you could guess, the web.sitemap file could be infinately deep(that's what the recursiveness is for, as you know).

<br />
private SiteMapPath GetSiteMapPath()<br />
		{<br />
			SiteMapPath objPath = new SiteMapPath();<br />
			SiteMapNode objCurrentNode = GetCurrentNode();<br />
			SiteMapNode objTempNode = new SiteMapNode();<br />
			int i = 0;<br />
			bool found = false;<br />
<br />
			// always add the root node<br />
			objPath.Add(this.siteMapNode);<br />
<br />
			if(objCurrentNode != this.siteMapNode)<br />
			{<br />
				while(!found)<br />
				{<br />
					objTempNode = this.siteMapNode.NodeList[i];<br />
					if(objTempNode == objCurrentNode)<br />
					{<br />
						objPath.Add(objTempNode);<br />
						found = true;<br />
					}<br />
					else<br />
					{<br />
						if(objTempNode.HasLeaf)<br />
						{<br />
							foreach(SiteMapNode objNode in objTempNode.NodeList)<br />
							{<br />
								if(objNode == objCurrentNode)<br />
								{<br />
									objPath.Add(objTempNode);<br />
									objPath.Add(objNode);<br />
									found = true;<br />
									break;<br />
								}<br />
							}<br />
						}<br />
					}<br />
<br />
					i += 1;<br />
				}<br />
			}<br />
<br />
			return objPath;<br />
		}<br />
<br />
		private SiteMapNode GetCurrentNode()<br />
		{<br />
			SiteMapNode resultNode = new SiteMapNode();<br />
			SiteMapNode tempNode = new SiteMapNode();<br />
			int i = 0;<br />
			bool found = false;<br />
<br />
			if(this.siteMapNode.Url.Equals(this.currentUrl.PathAndQuery))<br />
				resultNode = this.siteMapNode;<br />
			else<br />
			{<br />
				while(!found)<br />
				{<br />
					tempNode = this.siteMapNode.NodeList[i];<br />
					if(tempNode.Url.Equals(this.currentUrl.PathAndQuery))<br />
					{<br />
						resultNode = tempNode;<br />
						found = true;<br />
					}<br />
					else<br />
					{<br />
						if(tempNode.HasLeaf)<br />
						{<br />
							foreach(SiteMapNode node in tempNode.NodeList)<br />
							{<br />
								if(node.Url.Equals(this.currentUrl.PathAndQuery))<br />
								{<br />
									resultNode = node;<br />
									found = true;<br />
									break;<br />
								}<br />
							}<br />
						}<br />
					}<br />
<br />
					i += 1;<br />
				}<br />
			}<br />
<br />
			return resultNode;<br />
		}<br />

GeneralRe: Code Rewrite Pin
Heath Stewart21-Jun-04 3:55
protectorHeath Stewart21-Jun-04 3:55 
GeneralNoteBook control Pin
elvisman20-Jun-04 17:07
elvisman20-Jun-04 17:07 
GeneralRe: NoteBook control Pin
Dave Kreskowiak21-Jun-04 4:17
mveDave Kreskowiak21-Jun-04 4:17 
GeneralRe: NoteBook control Pin
elvisman22-Jun-04 16:36
elvisman22-Jun-04 16:36 
GeneralUsing OpenSchema in C# Pin
ctbmei20-Jun-04 16:58
ctbmei20-Jun-04 16:58 
Generalthe problem of drawing on UserControl Pin
luming112233445520-Jun-04 16:46
luming112233445520-Jun-04 16:46 
GeneralRe: the problem of drawing on UserControl Pin
vcorn20-Jun-04 19:45
vcorn20-Jun-04 19:45 
GeneralRe: the problem of drawing on UserControl Pin
Heath Stewart21-Jun-04 4:00
protectorHeath Stewart21-Jun-04 4:00 
GeneralGDI+'s Question Pin
jzb20-Jun-04 16:28
jzb20-Jun-04 16:28 
GeneralRe: GDI+'s Question Pin
Dave Kreskowiak21-Jun-04 4:21
mveDave Kreskowiak21-Jun-04 4:21 
GeneralRe: GDI+'s Question Pin
jzb21-Jun-04 17:55
jzb21-Jun-04 17:55 
GeneralInternet Explorer Plugin Pin
J. Dunlap20-Jun-04 16:06
J. Dunlap20-Jun-04 16:06 
GeneralRe: Internet Explorer Plugin Pin
Michael P Butler20-Jun-04 22:34
Michael P Butler20-Jun-04 22:34 
GeneralRe: Internet Explorer Plugin Pin
Heath Stewart21-Jun-04 4:06
protectorHeath Stewart21-Jun-04 4:06 
GeneralTabControl BackColor Pin
bneacetp20-Jun-04 12:12
bneacetp20-Jun-04 12:12 
GeneralLeft click a button and see the context menu Pin
StephenMcAllister20-Jun-04 10:38
StephenMcAllister20-Jun-04 10:38 
GeneralRe: Left click a button and see the context menu Pin
bneacetp20-Jun-04 12:21
bneacetp20-Jun-04 12:21 

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.