Post

MS Research TreeMap.Net

Paschal L points out the Microsoft Research’s TreeMap.Net.  It’s an interested way to view information.  I saw it a while back as a map showing the newsgroup traffic.  However, I didn’t even think of using this model to view your drive usage.  Now that’s pretty cool.  I downloaded it and had to dig in and play around with it.  The code is pretty good, but could see a lot of improvement.  They are using FileSystemObject via COM Interop to get the drives, files and folder tree information.  And yes, I just couldn’t leave well enough alone, it’s written in C#.  I converted it to VB.NET and replace all of the FileSystemObject stuff with .NET FCL equivalents (IO.Directory and IO.File) and had to bring in some Win32 P/Invoke methods I put together for the FileSystemObject Replacement Project.  I also modified it so that it would cache the folder sizes so as you drill down, it’s instantaneous.  The only hit is when you first drill into a drive.

Tree Map

UPDATE: Ready for download. Made even a few more changes.  Went ahead and put back in the FileSystemObjects and allow you to specify which model to use by specify a member variable in Form1 (_useFSO = True/False).  The reason is that FSO seems to be a lot faster at calculating directory size than the other method I was trying to use.  Weird.  I wonder what Microsoft is doing to get directory size so fast.  Also, as a sort of experiment, I added a list view to show the files in the current views folder.  Kind of turns it into a little Explorer type application.  Anyways, here’s a link to download TreeMap.Net Explorer with source.  Also, be sure to get the necessary TreeMap.Net controls directly from Microsoft.

UPDATE: Although at first glance I thought the code wasn’t really great.  After the fact, I was contacted by the original author and he pointed out that it was written in like a half an hour.  I would have known that if I read the article, but it was in French and Google just didn’t want to seem to translate it; so all I had to go off was the source.  OK, so the code is pretty cool for a half hours worth of work ;-)  It can obviously use some improvements, but nonetheless, pretty cool so far.  So this is an official apologize to Richard Clark of c2i.fr for any comments that may have been harsh (and such comments have been removed).  Also, with further experimentation, using the FileSystemObject proves to actually be faster… who would of thunk?

This post is licensed under CC BY 4.0 by the author.