Click here to Skip to main content
15,923,015 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Socket is closed before all buffered data is transmitted Pin
realbobb12-May-08 21:06
realbobb12-May-08 21:06 
Question"?xml namespace="" prefix="asp" ?" in .NET 2005 Pin
salon8-May-08 4:39
salon8-May-08 4:39 
QuestionGet the proper path name, proper case I mean. Pin
AndrewVos8-May-08 3:38
AndrewVos8-May-08 3:38 
AnswerRe: Get the proper path name, proper case I mean. Pin
Dave Kreskowiak8-May-08 4:59
mveDave Kreskowiak8-May-08 4:59 
GeneralRe: Get the proper path name, proper case I mean. Pin
AndrewVos8-May-08 5:14
AndrewVos8-May-08 5:14 
AnswerRe: Get the proper path name, proper case I mean. Pin
Dave Kreskowiak8-May-08 5:32
mveDave Kreskowiak8-May-08 5:32 
GeneralRe: Get the proper path name, proper case I mean. Pin
AndrewVos8-May-08 5:39
AndrewVos8-May-08 5:39 
GeneralRe: Get the proper path name, proper case I mean. Pin
AndrewVos8-May-08 6:12
AndrewVos8-May-08 6:12 
Ok, I've got everything working.

It seems GetDirectories is actually fast enough when using a search pattern.

Thanks for reading through the code, and here's what I'm using now.

<br />
		public List<string> Generate(string generationString) {<br />
			List<string> results = new List<string>();<br />
<br />
			string[] pathParts = generationString.Split(Path.DirectorySeparatorChar);<br />
			DirectoryInfo currentDirectory = null;<br />
<br />
			for (int index = 0; index < pathParts.Length;index++ ) {<br />
				string pathPart = pathParts[index];<br />
<br />
				if (index == 0) {<br />
					//The first part will be the drive.<br />
					DriveInfo[] drives = DriveInfo.GetDrives();<br />
					foreach (DriveInfo drive in drives) {<br />
						if (drive.Name.StartsWith(pathPart, StringComparison.InvariantCultureIgnoreCase)) {<br />
							currentDirectory = drive.RootDirectory;<br />
						}<br />
					}<br />
					if (currentDirectory == null) {<br />
						break;<br />
					}<br />
				} else if ((index == pathParts.Length - 1) ) {<br />
				//The last part could be anything, so we do a wildcard search.<br />
					try {<br />
						results.AddRange(Directory.GetDirectories(currentDirectory.FullName, pathPart + "*"));<br />
						results.AddRange(Directory.GetFiles(currentDirectory.FullName, pathPart + "*"));<br />
					} catch { }<br />
				} else {<br />
					//Just add the first result to the path.<br />
					DirectoryInfo[] searchResults = currentDirectory.GetDirectories(pathPart);<br />
					if (searchResults.Length == 0) {<br />
						break;<br />
					} else {<br />
						currentDirectory = searchResults[0];<br />
					}<br />
				}<br />
			}<br />
<br />
			return results;<br />
		}<br />
</string></string></string>




www.wickedorange.com
www.andrewvos.com

Questiongetting input from user Pin
raydona7-May-08 8:11
raydona7-May-08 8:11 
AnswerRe: getting input from user Pin
Dave Kreskowiak7-May-08 8:42
mveDave Kreskowiak7-May-08 8:42 
Questionhow to use SetWindowLong API function calling in Vb.net Pin
brams77-May-08 4:04
brams77-May-08 4:04 
AnswerRe: how to use SetWindowLong API function calling in Vb.net Pin
Dave Kreskowiak7-May-08 7:12
mveDave Kreskowiak7-May-08 7:12 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
brams77-May-08 10:33
brams77-May-08 10:33 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
Dave Kreskowiak7-May-08 10:57
mveDave Kreskowiak7-May-08 10:57 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
brams79-May-08 4:40
brams79-May-08 4:40 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
Dave Kreskowiak9-May-08 5:44
mveDave Kreskowiak9-May-08 5:44 
QuestionLooking for something that replaces the event DataGridView.SelectionChanging Pin
Shimmy Weitzhandler6-May-08 12:21
Shimmy Weitzhandler6-May-08 12:21 
AnswerRe: Looking for something that replaces the event DataGridView.SelectionChanging Pin
Shimmy Weitzhandler6-May-08 12:57
Shimmy Weitzhandler6-May-08 12:57 
Question[Message Deleted] Pin
Macorina6-May-08 10:41
Macorina6-May-08 10:41 
AnswerCross Post. Please ignore Pin
Pete O'Hanlon6-May-08 10:56
mvePete O'Hanlon6-May-08 10:56 
GeneralRe: Cross Post. Please ignore Pin
leckey7-May-08 6:46
leckey7-May-08 6:46 
GeneralRe: Cross Post. Please ignore Pin
Pete O'Hanlon7-May-08 9:10
mvePete O'Hanlon7-May-08 9:10 
GeneralRe: Cross Post. Please ignore Pin
iamstillalive7-May-08 22:56
iamstillalive7-May-08 22:56 
GeneralRe: Cross Post. Please ignore Pin
Pete O'Hanlon8-May-08 0:51
mvePete O'Hanlon8-May-08 0:51 
GeneralRe: Cross Post. Please ignore Pin
Dave Kreskowiak8-May-08 2:56
mveDave Kreskowiak8-May-08 2:56 

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.