C# - Arguments via file drop
This issue came up a while ago, but after getting deeper into C# I’ve now been able to track down the answer.
The problem involved loading a dynamic flash file into C# on the fly while still being able to load a default in its absence. You could of course use an XML file but then you would just have to edit it each time you used a different path – lame.
So this solution allows for you to drag a file/files onto an application’s icon, and retrieve a list of those dropped items. If it can’t find your file extension in the argument’s array it’ll return the path to your default file.
The best part about this is just how easy it is to get that list.
One thing to keep in mind ( at least for me ) was that the first array element is a reference to the application being launched. If you drop multiple files I couldn’t tell if they were in any specific order, so I chose to loop through the array instead of picking a consistent element index.
» Permalink » Comments » del.icio.us » Digg It!
