I need to import tracks from a CD but so far I am unable in doing so. I can successfully import .mp3 or many other audio formats from a CD. For importing purpose first I scan files and folder of a CD. Then I show the list of files to user and copy files that user selects from list.
Here is my code for scanning a Directory or a CD:
List<StorageFile> allTrackFiles = null;
private async Task GetFiles(StorageFolder folder)
{
if(!scanningRemovableTask)
{
return;
}
try
{
if(allTrackFiles == null)
{
allTrackFiles = new List<StorageFile>();
}
var items = await folder.GetItemsAsync();
foreach (var item in items)
{
if (item.GetType() == typeof(StorageFile))
{
StorageFile storageFile = item as StorageFile;
allTrackFiles.Add(storageFile);
var basicProperties = await storageFile.GetBasicPropertiesAsync();
var musicProperties = await storageFile.OpenReadAsync();
}
else
await GetFiles(item as StorageFolder);
}
}
catch(Exception e)
{
}
}
I pass the CD path to this function and it creates a list of files for me. This code works fine when CD has only .mp3 or any famous Audio format. But it creates trouble when CD has .CDA extension tracks. As we know that .CDA files are itself doesn't play, they are just shortcuts to the original media files.
Now, this is where I am stuck right now. How to read .CDA files or import .CDA files media to our local Directory in universal windows app.