Introduction
Lately, I often need to get all the sources of the project together with all the dependencies etc. So, I looked for a tool to select all the desired files and copy them to a single directory. Since I didn't find one, I wrote one.
Using FileCollector
In the main tree, you can select the files you want. Every selection (positive or negative) affects the entire subtree. So you can, for instance, first select the project dir, then deselect the bin and obj and any other files you don't want to take, and so on.
Once you selected all the directories and files, specify a target path, and start the collecting. Warning: Since I figured that the target path is for this purpose only and, even more, is temporary, the tool deletes the target path every time you start collecting.
And the best thing is: if you select the desired files and save the settings to a .fc file, you can start the collection by choosing the context-menu option 'Start' in the Explorer, without bothering to open the Form. That way, you can get the target up to date really quickly.
About the Code
The interesting part is the main treeview. Icons for this one are extracted like shown in furty's FolderTreeView. The delete and copy business (with the nice Windows dialogs) is done with help from arikp's "C# does shell, Part 2". So thanks to both of them - this simply makes a tool look much more 'Windows' ;).
Information about the selected items is stored in the CollectorSettings
class by means of positive and negative information. Nothing fancy. The rest is some event handling and some System.IO
- but no need to write another article on that stuff :)