You can retrieve the packages names fairly easy by querying the MSDB database, if they are stored into the SQL Server database or in the package store.
If they are stored in the file system, you only need to go to the directory and list all the files that have the .dtsx extension. (The .NET classes DirectoryInfo and FileInfo can be useful).
To get the task names, that will be more difficult I guess. You'll have to address the SSIS .NET API extensions (or even worse, the COM extensions), but unfortunately I have no experience with this.
I do know it is possible though, I've seen a colleague do it 🙂
(alternatively, you could parse the XML file - since dtsx is actually a big XML file - to retrieve the task names)